[libcxx-commits] [PATCH] D101316: [libcxx][ranges] Add `random_access_{iterator, range}`.

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 3 16:13:44 PDT 2021


cjdb added inline comments.


================
Comment at: libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp:26
 static_assert(std::bidirectional_iterator<iterator>);
+static_assert(std::random_access_iterator<iterator>);
 static_assert(!std::indirectly_writable<iterator, value_type>);
----------------
Quuxplusone wrote:
> For my own curiosity: I thought the new definition of `forward_iterator` was that its `reference` type needed to be `value_type&`. How does `vector<bool>::iterator` still manage to qualify as a `random_access_iterator`, then?
> (This is presumably not a bug with this patch; I ask only for information.)
It's the other way around: //[[ http://eel.is/c++draft/forward.iterators | Cpp17ForwardIterator ]]// demands a genuine reference, while [[ http://eel.is/c++draft/iterator.concept.forward | forward_iterator ]] just wants `decltype(*i)` to be something you can make into a reference (apparently `void` isn't the only thing you can't make into a reference?).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101316



More information about the libcxx-commits mailing list