[PATCH] Change StringRef size_t instances to size_type

Chandler Carruth chandlerc at google.com
Wed May 1 17:06:31 PDT 2013


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.


>
> ~Aaron
>
> On Wed, May 1, 2013 at 6:49 PM, Chris Lattner <clattner at apple.com> wrote:
> >
> > On May 1, 2013, at 3:48 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
> >
> >> Certainly, but then why leave the size_type typedef in?  Is it
> >> beneficial in some way?
> >
> > It follows the STL.  Some generic STL algorithms presumably use it.
> >
> > -Chris
> >
> >>
> >> ~Aaron
> >>
> >> On Wed, May 1, 2013 at 6:36 PM, Chris Lattner <clattner at apple.com>
> wrote:
> >>>
> >>> On May 1, 2013, at 12:46 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
> >>>
> >>>> The StringRef datatype has mixed usage of size_t and size_type in its
> >>>> interface.  This patch changes usages of size_t into size_type for
> >>>> consistency.
> >>>
> >>> Can we standardize the other way?  Use size_t for everything except
> the typedef of size_type?
> >>>
> >>> -Chris
> >
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130502/866c822b/attachment.html>


More information about the llvm-commits mailing list