[iterator.concept.contiguous]

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

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

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

#### 24.3.4.14 Concept contiguous_iterator [iterator.concept.contiguous]

[1](#1)

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

The [contiguous_iterator](#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") concept provides a guarantee that
the denoted elements are stored contiguously in memory[.](#1.sentence-1)

template<class I>concept [contiguous_iterator](#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") =[random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13 Concept random_­access_­iterator [iterator.concept.random.access]")<I> &&[derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_­from [concept.derived]")<*ITER_CONCEPT*(I), contiguous_iterator_tag> && is_lvalue_reference_v<iter_reference_t<I>> &&[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<iter_value_t<I>, remove_cvref_t<iter_reference_t<I>>> &&requires(const I& i) {{ to_address(i) } -> [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<add_pointer_t<iter_reference_t<I>>>; };

[2](#2)

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

Let a and b be dereferenceable iterators andc be a non-dereferenceable iterator of type I such that b is reachable from a andc is reachable from b,
and let D be iter_difference_t<I>[.](#2.sentence-1)

The type I models [contiguous_iterator](#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") only if

- [(2.1)](#2.1)

to_address(a) == addressof(*a),

- [(2.2)](#2.2)

to_address(b) == to_address(a) + D(b - a),

- [(2.3)](#2.3)

to_address(c) == to_address(a) + D(c - a),

- [(2.4)](#2.4)

to_address(I{}) is well-defined,

- [(2.5)](#2.5)

ranges​::​iter_move(a) has
the same type, value category, and effects as std​::​move(*a), and

- [(2.6)](#2.6)

if ranges​::​iter_swap(a, b) is well-formed,
it has effects equivalent to ranges​::​swap(*a, *b)[.](#2.sentence-2)
