[range.prim.empty]

# 25 Ranges library [[ranges]](./#ranges)

## 25.3 Range access [[range.access]](range.access#range.prim.empty)

### 25.3.13 ranges​::​empty [range.prim.empty]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L1153)

The name ranges​::​empty denotes a customization point
object ([[customization.point.object]](customization.point.object "16.3.3.3.5 Customization Point Object types"))[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L1157)

Given a subexpression E with type T,
let t be an lvalue that denotes the reified object for E[.](#2.sentence-1)

Then:

- [(2.1)](#2.1)

  If T is an array of unknown bound ([[dcl.array]](dcl.array#term.array.type "9.3.4.5 Arrays")), ranges​::​empty(E) is ill-formed[.](#2.1.sentence-1)

- [(2.2)](#2.2)

  Otherwise, if bool(t.empty()) is a valid expression, ranges​::​empty(E) is expression-equivalent to bool(t.empty())[.](#2.2.sentence-1)

- [(2.3)](#2.3)

  Otherwise, if (ranges​::​size(t) == 0) is a valid expression, ranges​::​empty(E) is expression-equivalent to (ranges​::​size(t) == 0)[.](#2.3.sentence-1)

- [(2.4)](#2.4)

  Otherwise, if bool(ranges​::​begin(t) == ranges​::​end(t)) is a valid expression and
 the type of ranges​::​begin(t) models [forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11 Concept forward_­iterator [iterator.concept.forward]"), ranges​::​empty(E) is expression-equivalent to bool(​ranges​::​begin(t) == ranges​::​end(t))[.](#2.4.sentence-1)

- [(2.5)](#2.5)

  Otherwise, ranges​::​empty(E) is ill-formed[.](#2.5.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L1187)

[*Note [1](#note-1)*:

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

â *end note*]

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L1194)

[*Note [2](#note-2)*:

Whenever ranges​::​empty(E) is a valid expression,
it has type bool[.](#4.sentence-1)

â *end note*]
