[PATCH] D79740: Align mapped_iterator::reference type with mapped_iterator::operator*() return value.
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 11 21:04:54 PDT 2020
dblaikie added a comment.
In D79740#2030762 <https://reviews.llvm.org/D79740#2030762>, @dblaikie wrote:
> In D79740#2030720 <https://reviews.llvm.org/D79740#2030720>, @craig.topper wrote:
>
> > @dblaikie are you saying that a mapped_iterator that returns by value should never be used by a reverse_iterator?
>
>
> That's my hypothesis/understanding, yes. I'm open to other ideas/counterpoints.
An alternative: A mapped_iterator that invokes the functor on increment, and stores the result in the iterator itself. That way its op* can return a reference to that object, etc. Then you satisfy the other iterator requirements.
So, I guess, we could make that happen implicitly - if the functor returns by value we switch to an iterator implementation that stashes that value in a member, otherwise if it returns by reference we can assume it has storage elsewhere and use the existing implementation.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79740/new/
https://reviews.llvm.org/D79740
More information about the llvm-commits
mailing list