std::basic_const_iterator<Iter>:: operator constant-iterator
Iterator concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Iterator primitives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Algorithm concepts and utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Indirect callable concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Common algorithm requirements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Iterator adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Member functions | ||||
basic_const_iterator::operator
constant-iterator
|
||||
Non-member functions | ||||
(C++23)
(C++23)
(C++23)
(C++23)
|
||||
(C++23)
|
||||
(C++23)
|
||||
Helper classes | ||||
template
<
/*not-a-const-iterator*/
CI
>
requires
/*constant-iterator*/
<
CI
>
&&
|
(1) | (since C++23) |
template
<
/*not-a-const-iterator*/
CI
>
requires
/*constant-iterator*/
<
CI
>
&&
|
(2) | (since C++23) |
Returns the converted constant iterator to which an underlying iterator current can be explicitly or implicitly convertible.
CI
satisfies the exposition-only concept
/*not-a-const-iterator*/
if and only if it's not a specialization of
basic_const_iterator
.
Return value
current
current
)
Example
#include <iterator> #include <ranges> #include <vector> void foo(std::vector<int>::const_iterator) {} int main() { auto v = std::vector<int>(); { // ranges::cbegin below returns vector<int>::const_iterator auto i1 = std::ranges::cbegin(v); foo(i1); // okay } auto t = v | std::views::take_while([](int const x) { return x < 100; }); { // ranges::cbegin below returns basic_const_iterator<vector<int>::iterator> auto i2 = std::ranges::cbegin(t); foo(i2); // error until P2836R1 } }
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
P2836R1 | C++23 |
basic_const_iterator
doesn't follow its underlying type's convertibility
|
conversion operator provided |