Details
Diff Detail
Event Timeline
include/llvm/ADT/iterator.h | ||
---|---|---|
269 | This would make a non-conforming iterator (perhaps we should have a static_assert for this in iterator_adapter_base, if possible) - because you should be able to take references and pointers to op* and get the same thing back the next time you call op*, etc. So, at least in theory/to be conforming, the iterator would need a pointer member that it initializes in op* (or op++/ctor) and returns a reference to that. What do you think? Do we already have enough non-conforming iterators that this technicality isn't worth worrying about? Or is the extra contortion worthwhile? Is there a nice way to do it? (I suppose you have to do it in op*, because you don't know if the iterator is valid any other time so you can't pre-emptively initialize the pointer member) |
This would make a non-conforming iterator (perhaps we should have a static_assert for this in iterator_adapter_base, if possible) - because you should be able to take references and pointers to op* and get the same thing back the next time you call op*, etc.
So, at least in theory/to be conforming, the iterator would need a pointer member that it initializes in op* (or op++/ctor) and returns a reference to that.
What do you think? Do we already have enough non-conforming iterators that this technicality isn't worth worrying about? Or is the extra contortion worthwhile? Is there a nice way to do it? (I suppose you have to do it in op*, because you don't know if the iterator is valid any other time so you can't pre-emptively initialize the pointer member)