Reverse range adapter
Pete Cooper
peter_cooper at apple.com
Tue Jul 28 09:43:15 PDT 2015
Hi David
Please find attached a patch for a reverse range adapter. Its based on feedback you gave in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150720/289410.html <http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150720/289410.html>.
There are 2 versions. The first uses rbegin()/rend(), the second constructs std::reverse_iterators around begin()/end().
I was surprised to find I didn’t need enable_if or any other such tricks.
I’ve updated a single use of the pattern ‘for auto x : make_range(rbegin(), rend())’ to the new reverse method.
I was considering reverse_range instead as a name to avoid confusion with std::reverse. I’d prefer to not do make_reverse_range just to save on characters.
Feedback welcome.
Cheers,
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150728/9d05c7b9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reverse.patch
Type: application/octet-stream
Size: 5027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150728/9d05c7b9/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150728/9d05c7b9/attachment-0001.html>
More information about the llvm-commits
mailing list