std:: front_insert_iterator
|
헤더 파일에 정의됨
<iterator>
|
||
|
template
<
class
Container
>
class
front_insert_iterator
|
(C++17 이전) | |
|
template
<
class
Container
>
class front_insert_iterator ; |
(C++17 이후) | |
std::front_insert_iterator
는 생성된 컨테이너에 요소들을 앞쪽에 추가하는
LegacyOutputIterator
입니다. 이 반복자(역참조되었는지 여부와 관계없이)에 할당이 이루어질 때마다 컨테이너의
push_front()
멤버 함수가 호출됩니다.
std::front_insert_iterator
를 증가시키는 것은 아무런 동작도 수행하지 않습니다.
목차 |
멤버 타입
| 멤버 타입 | 정의 | ||||
iterator_category
|
std:: output_iterator_tag | ||||
value_type
|
void | ||||
difference_type
|
|
||||
pointer
|
void | ||||
reference
|
void | ||||
container_type
|
Container
|
|
멤버 타입
|
(C++17 이전) |
멤버 함수
새로운
front_insert_iterator
를 생성합니다
(public member function) |
|
|
객체를 연관된 컨테이너에 삽입합니다
(public member function) |
|
|
아무 작업도 수행하지 않음
(public member function) |
|
|
아무 작업도 수행하지 않음
(public member function) |
멤버 객체
| 멤버 이름 | 정의 |
container
(protected)
|
Container * 타입의 포인터 |
예제
#include <algorithm> #include <deque> #include <iostream> #include <iterator> #include <vector> namespace stb { void println(auto, auto const& d) { std::ranges::copy(d, std::ostream_iterator<int>(std::cout, " ")); std::cout << '\n'; } } int main() { std::vector<int> v{1, 2, 3, 4, 5}; std::deque<int> d; std::copy(v.begin(), v.end(), std::front_insert_iterator<std::deque<int>>(d)); // or std::front_inserter(d) stb::println("{}", d); }
출력:
5 4 3 2 1
참고 항목
|
인수에서 추론된 타입의
std::front_insert_iterator
를 생성함
(함수 템플릿) |
|
|
컨테이너의 끝에 삽입하기 위한 반복자 어댑터
(클래스 템플릿) |
|
|
컨테이너에 삽입하기 위한 반복자 어댑터
(클래스 템플릿) |