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

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 28 16:26:03 PDT 2018


chandlerc updated this revision to Diff 157876.
chandlerc added a comment.

Update with actual documentation (instead of it being missing or talking about
the wrong thing) and a more direct implementation strategy.

Initially, I tried to make this behave more like a normal forward iterator.
Unfortunately, that makes it substantially less powerful than the
early-increment patterned loops we use throughout LLVM because it precludes the
current iterator from becoming invalid -- we compare against it when
incrementing.

Instead, this now directly models the early-increment loops in LLVM. It makes
it a weird quasi-iterator-like thing, despite claiming to be an InputIterator.
I'm not sure if people will be happy with this but it seems functional and to
work quite nicely with the way LLVM would want to use it.


Repository:
  rL LLVM

https://reviews.llvm.org/D49956

Files:
  llvm/include/llvm/ADT/STLExtras.h
  llvm/unittests/ADT/STLExtrasTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49956.157876.patch
Type: text/x-patch
Size: 5086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180728/6ca93793/attachment.bin>


More information about the llvm-commits mailing list