C++ named requirements: LegacyRandomAccessIterator

A LegacyRandomAccessIterator is a LegacyBidirectionalIterator that can be moved to point to any element in constant time.

# Declarations

template<class I>
concept __LegacyRandomAccessIterator =
__LegacyBidirectionalIterator<I> && std::totally_ordered<I> &&
requires(I i, typename std::incrementable_traits<I>::difference_type n)
{
{ i += n } -> std::same_as<I&>;
{ i -= n } -> std::same_as<I&>;
{ i + n } -> std::same_as<I>;
{ n + i } -> std::same_as<I>;
{ i - n } -> std::same_as<I>;
{ i - i } -> std::same_as<decltype(n)>;
{ i[n] } -> std::convertible_to<std::iter_reference_t<I>>;
};

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 299(N3066)C++98the return type of a[n] was requiredto be convertible to const value_type&the return type is required tobe convertible to reference
LWG 448C++98the return type of a[n] was requiredto be convertible to value_typethe return type is required to beconvertible to const value_type&[1]
LWG 1079C++98b - a was defined using a < b,resulted in circular definitionremoved a < b from the definition
LWG 2114(P2167R3)C++98convertibility to bool was too weak to reflect the expectation of implementationsrequirements strengthened

# See also