[PATCH] D63632: Update the llvm::enumerate utility class result_pair to use the 'iterator_traits<R>::reference' instead of 'ValueOfIter<R> &'.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 17:16:59 PDT 2019


dblaikie added a comment.

In D63632#1556532 <https://reviews.llvm.org/D63632#1556532>, @rriddle wrote:

> My understanding is that input_iterators do not have to return a reference, and may return a value type or some other proxy object.
>
> (Sorry if there is a specific website that should be linked)
>  See specification of LegacyInputIterator: https://en.cppreference.com/w/cpp/named_req/InputIterator


This shows the issue I was mentioning - the third row of the table, that "i->m" must be equivalent to (*i).m. streambuf_iterator sidesteps it a bit perhaps because it never has a type for which "->" is valid (well, maybe it can - with a user CharT with members).

It suggests it can be implemented in other ways - with an opaque handle type rather than an actual pointer to the element type - but that's not the issue with mapped_iterator, for instance. So it still seems like mapped_iterator can/should be fixed here?

> See example of iterator returning a value_type, std::istreambuf_iterator: https://en.cppreference.com/w/cpp/iterator/istreambuf_iterator




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63632/new/

https://reviews.llvm.org/D63632





More information about the llvm-commits mailing list