Files
2025-10-25 03:02:53 +03:00

2.9 KiB
Raw Permalink Blame History

[range.access.begin]

25 Ranges library [ranges]

25.3 Range access [range.access]

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

1

#

The name ranges::begin denotes a customization point object ([customization.point.object]).

2

#

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

Then:

  • (2.1)

    If E is an rvalue and enable_borrowed_range<remove_cv_t> is false, ranges::begin(E) is ill-formed.

  • (2.2)

    Otherwise, if T is an array type ([dcl.array]) and remove_all_extents_t is an incomplete type, ranges::begin(E) is ill-formed with no diagnostic required.

  • (2.3)

    Otherwise, if T is an array type, ranges::begin(E) is expression-equivalent to t + 0.

  • (2.4)

    Otherwise, if auto(t.begin()) is a valid expression whose type models input_or_output_iterator, ranges::begin(E) is expression-equivalent to auto(t.begin()).

  • (2.5)

    Otherwise, if T is a class or enumeration type and auto(begin(t)) is a valid expression whose type models input_or_output_iterator where the meaning of begin is established as-if by performing argument-dependent lookup only ([basic.lookup.argdep]), then ranges::begin(E) is expression-equivalent to that expression.

  • (2.6)

    Otherwise, ranges::begin(E) is ill-formed.

3

#

[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]

4

#

[Note 2:

Whenever ranges::begin(E) is a valid expression, its type modelsinput_or_output_iterator.

— end note]