[optional.ref.iterators]

# 22 General utilities library [[utilities]](./#utilities)

## 22.5 Optional objects [[optional]](optional#ref.iterators)

### 22.5.4 Partial specialization of optional for reference types [[optional.optional.ref]](optional.optional.ref#optional.ref.iterators)

#### 22.5.4.5 Iterator support [optional.ref.iterators]

[ð](#itemdecl:1)

`using iterator = implementation-defined;
`

[1](#1)

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

This type
models [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]") ([[iterator.concept.contiguous]](iterator.concept.contiguous "24.3.4.14 Concept contiguous_­iterator")),
meets the *Cpp17RandomAccessIterator* requirements ([[random.access.iterators]](random.access.iterators "24.3.5.7 Random access iterators")),
and meets the requirements for constexpr iterators ([[iterator.requirements.general]](iterator.requirements.general "24.3.1 General")),
with value type remove_cv_t<T>[.](#1.sentence-1)

The reference type is T& for iterator[.](#1.sentence-2)

[2](#2)

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

All requirements on container iterators ([[container.reqmts]](container.reqmts "23.2.2.2 Container requirements")) apply tooptional​::​iterator[.](#2.sentence-1)

[ð](#itemdecl:2)

`constexpr iterator begin() const noexcept;
`

[3](#3)

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

*Returns*: If has_value() is true,
 an iterator referring to **val*[.](#3.sentence-1)

Otherwise, a past-the-end iterator value[.](#3.sentence-2)

[ð](#itemdecl:3)

`constexpr iterator end() const noexcept;
`

[4](#4)

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

*Returns*: begin() + has_value()[.](#4.sentence-1)
