[range.prim.size.hint]

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

## 25.3 Range access [[range.access]](range.access#range.prim.size.hint)

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

[1](#1)

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

The name ranges​::​reserve_hint 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#L1113)

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 ranges​::​size(E) is a valid expression,ranges​::​reserve_hint(E) is expression-equivalent toranges​::​size(E)[.](#2.1.sentence-1)

- [(2.2)](#2.2)

  Otherwise,
if auto(t.reserve_hint()) is a valid expression of
integer-like type ([[iterator.concept.winc]](iterator.concept.winc "24.3.4.4 Concept weakly_­incrementable")),ranges​::​reserve_hint(E) is expression-equivalent toauto(t.reserve_hint())[.](#2.2.sentence-1)

- [(2.3)](#2.3)

  Otherwise,
if T is a class or enumeration type andauto(reserve_hint(t)) is a valid expression of
integer-like type where
the meaning of reserve_hint is established as-if by
performing argument-dependent lookup only ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4 Argument-dependent name lookup")), thenranges​::​reserve_hint(E) is expression-equivalent to that expression[.](#2.3.sentence-1)

- [(2.4)](#2.4)

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

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

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

â *end note*]

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

Whenever ranges​::​reserve_hint(E) is a valid expression,
its type is integer-like[.](#2.sentence-4)

â *end note*]
