Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Stack
- Array
- 컴퓨터 그래픽스
- 수광 소자
- vector
- LineTracer
- stl
- directx
- queue
- 아두이노
- Deque
- Arduino
- Algorithm
- 라인트레이서
- Visual Micro
- html
- list
- 시스템프로그래밍
- 아두이노 컴파일러
- 아두이노 소스
- c++
- arduino compiler
- map
- 통계학
- 운영체제
- set
- priority_queue
- 자료구조
- WinAPI
- C언어
Archives
- Today
- Total
Kim's Programming
List - erase() 본문
소스)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include<list> #include<iostream> void print(std::list<int> Target_List) { for (std::list<int>::iterator IterPos = Target_List.begin(); IterPos != Target_List.end(); ++IterPos) std::cout << *IterPos << " "; std::cout << std::endl; } void main() { std::list<int> List = { 1,2,3,4,100,101,102,103 }; print(List); List.erase(List.begin()); print(List); List.erase(++List.begin(),--List.end()); print(List); } | cs |
내용)
erase 함수는 2가지 경우가 있습니다.
- erase(x)
이터레이터 x가 가리키는 대상을 삭제합니다. - erase(x,y)
이터레이터 x와 이터레이터 y사이의 모든 데이터를 삭제합니다.
결과)
'STL - Container > Container - List' 카테고리의 다른 글
List - insert() (0) | 2016.01.29 |
---|---|
List - front() (0) | 2016.01.29 |
List - end() (0) | 2016.01.29 |
List - empty() (0) | 2016.01.29 |
List - emplace_front() (0) | 2016.01.29 |