Add llvm::enumerate() to stl extras

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 13:11:26 PDT 2016


I don't think so, but someone correct me if I'm wrong.  enumerator works
with ranges, not iterators.  So by extension enumerate should also be
considered to return a range, and not an iterator.  The baggage associated
with ranges are much less than that associated with iterators.  As long as
you have a begin and an end you're good to go.

But then again who knows, someone with more knowledge than me will have to
chime in :)

On Thu, Sep 29, 2016 at 1:06 PM Adrian McCarthy <amccarth at google.com> wrote:

> Should `enumerator_impl::iterator` have the extra baggage for
> `std::iterator_traits`, like typedefs for `value_type`,
> `iterator_category`, and such?
>
> On the other hand, if this is strictly for range-based for loops, then
> perhaps you don't even need the post-fix increment.
>
>
> On Thu, Sep 29, 2016 at 12:34 PM, Zachary Turner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> Yes, you beat me to it.  I just used container in my example, but the
> implementation is supposed to work with any range
>
> On Thu, Sep 29, 2016 at 12:33 PM Krzysztof Parzyszek via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> On 9/29/2016 2:27 PM, Krzysztof Parzyszek via llvm-commits wrote:
> >
> > How about enumerate(range) instead of container?
>
> Nevermind.  It's the same thing.
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160929/4644c124/attachment.html>


More information about the llvm-commits mailing list