[PATCH] Change StringRef size_t instances to size_type

Chris Lattner clattner at apple.com
Wed May 1 22:56:53 PDT 2013


On May 1, 2013, at 5:06 PM, Chandler Carruth <chandlerc at google.com> wrote:

> On Thu, May 2, 2013 at 1:02 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Then wouldn't it make sense for our APIs (at least the ones STL-ish)
> to use size_type in case someone wants to vary it?
> 
> It makes sense for an *algorithm* to use size_type of a data structure it operates on in the event the data structure overrides it.
> 
> It makes sense for a data structure to use 'size_t' because its simpler.
> 
> It makes sense for a data structure to typedef 'size_t' to 'size_type' to tell algorithms that it has elected to use that definition.
>  

Yep, what Chandler said.  There is no reasonable way to vary it in StringRef, so the abstraction would just obfuscate the code.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130501/79dbbcae/attachment.html>


More information about the llvm-commits mailing list