[PATCH] D49956: [ADT] Add an early-increment iterator and range adaptor.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 20:08:11 PDT 2018


We have many, many for loops still using iterators for this....

If you search for thinsg like `Foo &Var = *It++;` with different
identifiers you will find a bunch.

I think we would be unsuccessful at converting them to lambda accepting
algorithms. The range based for loop seems likely the most we would succeed
in threading through how people think about this.... I mean, if there is no
consensus for this iterator-like thing, then maybe we have to go w/
algorithms. My fear is that it means we will just go with iterator for
loops.

On Mon, Jul 30, 2018 at 7:31 PM David Blaikie via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:

> dblaikie added a comment.
>
> Yeah, that's vaguely frightening as a thing (I mean, yeah, the assertions
> help catch misuse - but still).
>
> Got a pointer to an example of where you want to do this? Any chance of
> inverting this into a lambda-driven algorithm instead, maybe?
>
>   pre_inc_for(R, [&](const auto &V) {
>     ...
>   });
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D49956
>
>
>
> _______________________________________________
> 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/20180730/8a3a84b6/attachment.html>


More information about the llvm-commits mailing list