[PATCH] D27874: ilist_iterator: Allow conversion between reverse and forward iterators

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 15:10:42 PST 2017


+Kyle, for his thoughts.

Two comments:

1. I'd rather not do this until Kyle Butt's comments are sorted out somehow:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170102/417159.html

He made a good point about being able to easily convert ranges.  One possibility is to leave `getReverse()` as is, and add:
--
explicit iterator(reverse_iterator I) : I(++I.getReverse().base()) {}
explicit reverse_iterator(iterator I) : I(++I.getReverse().base()) {}
--
This gives explicit conversions between forward/reverse iterators that respect range, and leaves behind getReverse() for explicitly getting the reverse iterator to the same list item.

2. Regardless, I think the conversions should be `explicit`-only.


> On 2017-Jan-25, at 14:00, Matthias Braun via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> MatzeB added a comment.
> 
> ping
> 
> 
> Repository:
>  rL LLVM
> 
> https://reviews.llvm.org/D27874
> 
> 
> 



More information about the llvm-commits mailing list