[range.access] (original) (raw)

25 Ranges library [ranges]

25.3.1 General [range.access.general]

In addition to being available via inclusion of the header, the customization point objects in [range.access] are available when the header is included.

Within [range.access], the reified object of a subexpression E denotes

25.3.2 ranges​::​begin [range.access.begin]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​begin(E)appears in the immediate context of a template instantiation.

— _end note_]

25.3.3 ranges​::​end [range.access.end]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​end(E)appears in the immediate context of a template instantiation.

— _end note_]

[Note 2:

Whenever ranges​::​end(E) is a valid expression, the types S and I ofranges​::​end(E) and ranges​::​begin(E)model sentinel_for<S, I>.

— _end note_]

25.3.4 ranges​::​cbegin [range.access.cbegin]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

25.3.5 ranges​::​cend [range.access.cend]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Whenever ranges​::​cend(E) is a valid expression, the types S and I of the expressionsranges​::​cend(E) and ranges​::​cbegin(E)model sentinel_for<S, I>.

If S models input_iterator, then S also models constant-iterator.

— _end note_]

25.3.6 ranges​::​rbegin [range.access.rbegin]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​rbegin(E)appears in the immediate context of a template instantiation.

— _end note_]

25.3.7 ranges​::​rend [range.access.rend]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​rend(E)appears in the immediate context of a template instantiation.

— _end note_]

[Note 2:

Whenever ranges​::​rend(E) is a valid expression, the types S and I of the expressionsranges​::​rend(E) and ranges​::​rbegin(E)model sentinel_for<S, I>.

— _end note_]

25.3.8 ranges​::​crbegin [range.access.crbegin]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

25.3.9 ranges​::​crend [range.access.crend]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Whenever ranges​::​crend(E) is a valid expression, the types S and I of the expressionsranges​::​crend(E) and ranges​::​crbegin(E)model sentinel_for<S, I>.

If S models input_iterator, then S also models constant-iterator.

— _end note_]

25.3.10 ranges​::​size [range.prim.size]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​size(E)appears in the immediate context of a template instantiation.

— _end note_]

[Note 2:

Whenever ranges​::​size(E) is a valid expression, its type is integer-like.

— _end note_]

25.3.11 ranges​::​ssize [range.prim.ssize]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

If ranges​::​size(t) is ill-formed,ranges​::​ssize(E) is ill-formed.

Otherwise let D be_make-signed-like-t_<decltype(ranges​::​​size(t))>, orptrdiff_t if it is wider than that type;ranges​::​ssize(E) is expression-equivalent tostatic_cast<D>(ranges​::​size(t)).

25.3.12 ranges​::​reserve_hint [range.prim.size.hint]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure whenranges​::​reserve_hint(E) appears in the immediate context of a template instantiation.

— _end note_]

[Note 2:

Whenever ranges​::​reserve_hint(E) is a valid expression, its type is integer-like.

— _end note_]

25.3.13 Approximately sized ranges [range.approximately.sized]

The approximately_sized_range concept refines rangewith the requirement that an approximation of the number of elements in the range can be determined in amortized constant time using ranges​::​reserve_hint.

template<class T> concept [approximately_sized_range](#concept:approximately%5Fsized%5Frange "25.3.13 Approximately sized ranges [range.approximately.sized]") = [range](range.range#concept:range "25.4.2 Ranges [range.range]")<T> && requires(T& t) { ranges::reserve_hint(t); };

Given an lvalue t of type remove_reference_t<T>,T models approximately_sized_range only if

25.3.14 ranges​::​empty [range.prim.empty]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​empty(E)appears in the immediate context of a template instantiation.

— _end note_]

[Note 2:

Whenever ranges​::​empty(E) is a valid expression, it has type bool.

— _end note_]

25.3.15 ranges​::​data [range.prim.data]

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges​::​data(E)appears in the immediate context of a template instantiation.

— _end note_]

[Note 2:

Whenever ranges​::​data(E) is a valid expression, it has pointer to object type.

— _end note_]

25.3.16 ranges​::​cdata [range.prim.cdata]

template<class T> constexpr auto as-const-pointer(const T* p) noexcept { return p; }

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

[Note 1:

Whenever ranges​::​cdata(E) is a valid expression, it has pointer to constant object type.

— _end note_]