2.3 KiB
[range.prim.empty]
25 Ranges library [ranges]
25.3 Range access [range.access]
25.3.13 ranges::empty [range.prim.empty]
The name ranges::empty denotes a customization point object ([customization.point.object]).
Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.
Then:
-
If T is an array of unknown bound ([dcl.array]), ranges::empty(E) is ill-formed.
-
Otherwise, if bool(t.empty()) is a valid expression, ranges::empty(E) is expression-equivalent to bool(t.empty()).
-
Otherwise, if (ranges::size(t) == 0) is a valid expression, ranges::empty(E) is expression-equivalent to (ranges::size(t) == 0).
-
Otherwise, if bool(ranges::begin(t) == ranges::end(t)) is a valid expression and the type of ranges::begin(t) models forward_iterator, ranges::empty(E) is expression-equivalent to bool(ranges::begin(t) == ranges::end(t)).
-
Otherwise, ranges::empty(E) is ill-formed.
[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]