This seems to be at the very least an inconsistency in range-v3
as compared to the Ranges TS working draft.
There's a quite sparse description as for why these same_as
predicates were added to to the readable
concept for iterators in range-v3
issue 1449.
Get the range library compiling with msvc 19.24.28319 with /std:c++17
...
- CPP_concept_fragment(readable_, (I),
+ CPP_concept_fragment(readable_,
+ requires (/*I const i*/) //
+ (
+ // { *i } -> same_as<iter_reference_t<I>>;
+ // { iter_move(i) } -> same_as<iter_rvalue_reference_t<I>>;
+ 0
+ ) &&
+ same_as<iter_reference_t<I const>, iter_reference_t<I>> &&
+ same_as<iter_rvalue_reference_t<I const>, iter_rvalue_reference_t<I>> &&
common_reference_with<iter_reference_t<I> &&, iter_value_t<I> &> &&
common_reference_with<iter_reference_t<I> &&,
iter_rvalue_reference_t<I> &&> &&
common_reference_with<iter_rvalue_reference_t<I> &&, iter_value_t<I> const &>
);
It seems the same_as
predicates in the concept's implementation are intended to implement the requirement of:
// { *i } -> same_as<iter_reference_t<I>>;
// { iter_move(i) } -> same_as<iter_rvalue_reference_t<I>>;
Which were present (as comments in range/v3/iterator/concepts.hpp
) even prior to this implementation change.
However, afaics, none of these requirements are present in the working draft of [iterators.readable] of Ranges TS (nor in the current HEAD
of ericniebler/stl2 from which the previous linked draft is generated).
[iterators.readable] Concept Readable
The Readable concept is satisfied by types that are readable by
applying operator* including pointers, smart pointers, and iterators.
template <class In>
concept bool Readable =
requires {
typename value_type_t<In>;
typename reference_t<In>;
typename rvalue_reference_t<In>;
} &&
CommonReference<reference_t<In>&&, value_type_t<In>&> &&
CommonReference<reference_t<In>&&, rvalue_reference_t<In>&&> &&
CommonReference<rvalue_reference_t<In>&&, const value_type_t<In>&>;
It may be a good idea to report this as an issue to, at the very least, sort out why the range-v3
implementation seemingly differs from [iterators.readable]
of Ranges TS.