[iterator.concept.forward]

# 24 Iterators library [[iterators]](./#iterators)

## 24.3 Iterator requirements [[iterator.requirements]](iterator.requirements#iterator.concept.forward)

### 24.3.4 Iterator concepts [[iterator.concepts]](iterator.concepts#iterator.concept.forward)

#### 24.3.4.11 Concept forward_iterator [iterator.concept.forward]

[1](#1)

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

The [forward_iterator](#concept:forward_iterator "24.3.4.11 Concept forward_­iterator [iterator.concept.forward]") concept adds
copyability, equality comparison, and
the multi-pass guarantee, specified below[.](#1.sentence-1)

template<class I>concept [forward_iterator](#concept:forward_iterator "24.3.4.11 Concept forward_­iterator [iterator.concept.forward]") =[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]")<I> &&[derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_­from [concept.derived]")<*ITER_CONCEPT*(I), forward_iterator_tag> &&[incrementable](iterator.concept.inc#concept:incrementable "24.3.4.5 Concept incrementable [iterator.concept.inc]")<I> &&[sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I, I>;

[2](#2)

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

The domain of == for forward iterators is that of iterators over the same
underlying sequence[.](#2.sentence-1)

However, value-initialized iterators of the same type
may be compared and shall compare equal to other value-initialized iterators of the same type[.](#2.sentence-2)

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

Value-initialized iterators behave as if they refer past the end of the same
empty sequence[.](#2.sentence-3)

â *end note*]

[3](#3)

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

Pointers and references obtained from a forward iterator into a range [i, s)
shall remain valid while [i, s) continues to denote a range[.](#3.sentence-1)

[4](#4)

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

Two dereferenceable iterators a and b of type X offer the [*multi-pass guarantee*](forward.iterators#def:multi-pass_guarantee "24.3.5.5 Forward iterators [forward.iterators]") if

- [(4.1)](#4.1)

a == b implies ++a == ++b and

- [(4.2)](#4.2)

the expression((void)[](X x){++x;}(a), *a) is equivalent to the expression *a[.](#4.sentence-1)

[5](#5)

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

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

The requirement thata == b implies++a == ++b and the removal of the restrictions on the number of assignments through
a mutable iterator
(which applies to output iterators)
allow the use of multi-pass one-directional algorithms with forward iterators[.](#5.sentence-1)

â *end note*]
