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 | 31 |
Tags
- vector
- LineTracer
- Deque
- WinAPI
- priority_queue
- queue
- 수광 소자
- set
- 시스템프로그래밍
- Algorithm
- Visual Micro
- 아두이노
- 라인트레이서
- 아두이노 컴파일러
- c++
- html
- Stack
- C언어
- Array
- 운영체제
- list
- 컴퓨터 그래픽스
- 자료구조
- stl
- map
- 통계학
- arduino compiler
- Arduino
- directx
- 아두이노 소스
Archives
- Today
- Total
Kim's Programming
List - assign() 본문
소스)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #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 }; std::list<int> List2 = { 0,0,0 }; List2.assign(++(List.begin()),--(List.end())); print(List2); List.assign(4, 3); print(List); } | cs |
내용)
assign함수는 리스트에 리스트에 값을 할당해주는 함수입니다. 기능은 두 가지가 있습니다.
- assigne(x,y)
이터레이터 x부터 이터레이터 y 까지의 데이터를 할당하여 줍니다. - assigne(x,y)
x개의 y를 리스트에 삽입합니다.
결과)
'STL - Container > Container - List' 카테고리의 다른 글
| List - cend() (0) | 2016.01.28 |
|---|---|
| List - cbegin() (0) | 2016.01.28 |
| List - begin() (0) | 2016.01.28 |
| List - back() (0) | 2016.01.28 |
| List - 멤버 변수 (0) | 2016.01.28 |