88 lines
3.1 KiB
Markdown
88 lines
3.1 KiB
Markdown
[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<I>, 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<S>, std::move(s)}[.](#2.sentence-1)
|
||
|
||
[ð](#lib:common_iterator,constructor__)
|
||
|
||
`template<class I2, class S2>
|
||
requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<const I2&, I> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<const S2&, S>
|
||
constexpr common_iterator(const common_iterator<I2, S2>& 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<i>, get<i>(x.v_)},
|
||
where i is x.v_.index()[.](#4.sentence-1)
|
||
|
||
[ð](#lib:operator=,common_iterator)
|
||
|
||
`template<class I2, class S2>
|
||
requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<const I2&, I> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<const S2&, S> &&
|
||
[assignable_from](concept.assignable#concept:assignable_from "18.4.8 Concept assignable_from [concept.assignable]")<I&, const I2&> && [assignable_from](concept.assignable#concept:assignable_from "18.4.8 Concept assignable_from [concept.assignable]")<S&, const S2&>
|
||
constexpr common_iterator& operator=(const common_iterator<I2, S2>& 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<i>(v_) = get<i>(x.v_)[.](#6.1.sentence-1)
|
||
|
||
- [(6.2)](#6.2)
|
||
|
||
Otherwise, v_.emplace<i>(get<i>(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)
|