r203353 - [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops.

Richard Smith richard at metafoo.co.uk
Sun Mar 9 13:35:36 PDT 2014


On Sun, Mar 9, 2014 at 5:41 AM, Aaron Ballman <aaron at aaronballman.com>wrote:

> On Sat, Mar 8, 2014 at 8:15 PM, Chandler Carruth <chandlerc at google.com>
> wrote:
> > Also, a separate meta-point:
> >
> > On Sat, Mar 8, 2014 at 10:45 AM, Aaron Ballman <aaron at aaronballman.com>
> > wrote:
> >>
> >> +  typedef specific_decl_range<EnumConstantDecl> enumerator_range;
> >
> >
> > Someone suggested this to me and I'm starting to agree -- I think we
> should
> > stop doing typedefs because it seems unlikely that these types should be
> > named by consumers at all between auto and the fact that the range
> itself is
> > unlikely to be used as a long-lived variable or parameter. Thoughts?
>
> I can't recall a single place where the type was written. Are you
> thinking we should use the pattern:
>
> auto foos() { return llvm::iterator_range<foo_iterator>(foo_begin(),
> foo_end()); }
>

No, deduced return types are a C++14 feature, certainly not supported by
all our supported compilers :)


> Also, would it make sense to add: llvm::make_range so we do not have
> to spell out the iterator types?
>
> ~Aaron
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140309/40e597c3/attachment.html>


More information about the cfe-commits mailing list