Does it make sense that the
std::move_iterator
T&
std::move_iterator<It>::reference
Because forward iterators requires that the reference type is of cv-T&, however
Incorrect. The standard (C++17, N4659, [forward.iterators]/1.3) says:
if
X
is a mutable iterator,reference
is a reference toT
; ifX
is a constant iterator,reference
is a reference to constT
Rvalue references are a "reference to T
". Therefore, they qualify. If they meant to exclude rvalue references, the standard would have said "lvalue reference to T
".
So it's perfectly valid for a ForwardIterator to return an rvalue reference.