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) | (C++23 이후) |
|
template
<
/*not-a-const-iterator*/
CI
>
requires
/*constant-iterator*/
<
CI
>
&&
|
(2) | (C++23 이후) |
기본 반복자가 명시적으로 또는 암시적으로 변환 가능한 변환된 상수 반복자를 반환합니다. current
CI
는 다음의 노출 전용(exposition-only) 개념을 만족합니다
/*not-a-const-iterator*/
, 이는 CI가
basic_const_iterator
의 특수화(specialization)가 아닌 경우에만 해당합니다.
반환값
current
current
)
예제
#include <iterator> #include <ranges> #include <vector> void foo(std::vector<int>::const_iterator) {} int main() { auto v = std::vector<int>(); { // 아래의 ranges::cbegin은 vector<int>::const_iterator를 반환합니다 auto i1 = std::ranges::cbegin(v); foo(i1); // 정상 동작 } auto t = v | std::views::take_while([](int const x) { return x < 100; }); { // 아래의 ranges::cbegin은 basic_const_iterator<vector<int>::iterator>를 반환합니다 auto i2 = std::ranges::cbegin(t); foo(i2); // P2836R1 이전까지 오류 발생 } }
결함 보고서
다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.
| DR | 적용 대상 | 게시된 동작 | 올바른 동작 |
|---|---|---|---|
| P2836R1 | C++23 |
basic_const_iterator
가 기본 타입의 변환 가능성을 따르지 않음
|
변환 연산자 제공 |