C++ named requirements: LegacyForwardIterator

A LegacyForwardIterator is a LegacyIterator that can read data from the pointed-to element.

# Declarations

template<class It>
concept __LegacyForwardIterator =
__LegacyInputIterator<It> && std::constructible_from<It> &&
std::is_reference_v<std::iter_reference_t<It>> &&
std::same_as<
std::remove_cvref_t<std::iter_reference_t<It>>,
typename std::indirectly_readable_traits<It>::value_type> &&
requires(It it) {
{ it++ } -> std::convertible_to<const It&>;
{ *it++ } -> std::same_as<std::iter_reference_t<It>>;
};

# Notes

Unlike the std::forward_iterator concept, the LegacyForwardIterator requirements requires dereference to return a reference.

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 1212(N3066)C++98the type of i++ did not match the type ofi– required by LegacyBidirectionalIteratorchanged thetype to Ref
LWG 1311(N3066)C++98“a == b implies ++a == ++b” alonedid not offer multipass guarantee[1]also requires “a == bimplies ++a != b”[2]
LWG 3798C++20__LegacyForwardIterator requiredstd::iter_reference_t to be an lvalue reference typealso allows rvaluereference types

# See also