[common.iter.const] # 24 Iterators library [[iterators]](./#iterators) ## 24.5 Iterator adaptors [[predef.iterators]](predef.iterators#common.iter.const) ### 24.5.5 Common iterators [[iterators.common]](iterators.common#common.iter.const) #### 24.5.5.3 Constructors and conversions [common.iter.const] [🔗](#lib:common_iterator,constructor) `constexpr common_iterator(I i); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5548) *Effects*: Initializes v_ as if by v_{in_place_type, std​::​move(i)}[.](#1.sentence-1) [🔗](#lib:common_iterator,constructor_) `constexpr common_iterator(S s); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5559) *Effects*: Initializes v_ as if byv_{in_place_type, std​::​move(s)}[.](#2.sentence-1) [🔗](#lib:common_iterator,constructor__) `template requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]") && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]") constexpr common_iterator(const common_iterator& x); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5573) *Hardened preconditions*: x.v_.valueless_by_exception() is false[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5577) *Effects*: Initializes v_ as if byv_{in_place_index, get(x.v_)}, where i is x.v_.index()[.](#4.sentence-1) [🔗](#lib:operator=,common_iterator) `template requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]") && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]") && [assignable_from](concept.assignable#concept:assignable_from "18.4.8 Concept assignable_­from [concept.assignable]") && [assignable_from](concept.assignable#concept:assignable_from "18.4.8 Concept assignable_­from [concept.assignable]") constexpr common_iterator& operator=(const common_iterator& x); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5593) *Hardened preconditions*: x.v_.valueless_by_exception() is false[.](#5.sentence-1) [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5597) *Effects*: Equivalent to: - [(6.1)](#6.1) If v_.index() == x.v_.index(), thenget(v_) = get(x.v_)[.](#6.1.sentence-1) - [(6.2)](#6.2) Otherwise, v_.emplace(get(x.v_))[.](#6.2.sentence-1) where i is x.v_.index()[.](#6.sentence-2) [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L5608) *Returns*: *this[.](#7.sentence-1)