Files
cppdraft_translate/cppdraft/counted/iter/const.md
2025-10-25 03:02:53 +03:00

59 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.4Concept 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.8Concept 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)