59 lines
1.9 KiB
Markdown
59 lines
1.9 KiB
Markdown
[counted.iter.const]
|
||
|
||
# 24 Iterators library [[iterators]](./#iterators)
|
||
|
||
## 24.5 Iterator adaptors [[predef.iterators]](predef.iterators#counted.iter.const)
|
||
|
||
### 24.5.7 Counted iterators [[iterators.counted]](iterators.counted#counted.iter.const)
|
||
|
||
#### 24.5.7.2 Constructors and conversions [counted.iter.const]
|
||
|
||
[ð](#lib:counted_iterator,constructor)
|
||
|
||
`constexpr counted_iterator(I i, iter_difference_t<I> n);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6013)
|
||
|
||
*Hardened preconditions*: n >= 0 is true[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6017)
|
||
|
||
*Effects*: Initializes current with std::move(i) andlength with n[.](#2.sentence-1)
|
||
|
||
[ð](#lib:counted_iterator,constructor_)
|
||
|
||
`template<class I2>
|
||
requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<const I2&, I>
|
||
constexpr counted_iterator(const counted_iterator<I2>& x);
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6031)
|
||
|
||
*Effects*: Initializes current with x.current andlength with x.length[.](#3.sentence-1)
|
||
|
||
[ð](#lib:operator=,counted_iterator)
|
||
|
||
`template<class I2>
|
||
requires [assignable_from](concept.assignable#concept:assignable_from "18.4.8 Concept assignable_from [concept.assignable]")<I&, const I2&>
|
||
constexpr counted_iterator& operator=(const counted_iterator<I2>& x);
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6045)
|
||
|
||
*Effects*: Assigns x.current to current andx.length to length[.](#4.sentence-1)
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6050)
|
||
|
||
*Returns*: *this[.](#5.sentence-1)
|