SlideShare a Scribd company logo
3
Bijarne Stroustrup
Alexander Stepanov
4
http://ko.wikipedia.org/wiki/표준_템플릿_라이브러리
5
6
7
8
10
12
 std::vector
 std::deque
 std::list
14
15
배열 std::vector
16
17
18
#include <vector> // 해더 파일
std::vector<int> vec; // 선언
vec.push_back(10); // 추가
vec.pop_back(); // 삭제
vec.resize(10, 0); // 초기화 : 10의 크기를 0으로 채움
vec[3] = 10; // 랜덤 접근
std::cout << vec[3] << std::endl; // 랜덤 접근
19
int nSum = 0;
for (int i = 0; i < vec.size(); i++)
{
nSum += vec[i];
}
// auto = std::iterator<std::vector<int>>
for (auto it = vec.begin(); it != vec.end(); it++)
{
nSum += (*it);
}
21
std::vector
22
23
#include <deque> // 해더 파일
std::deque<int> deq; // 선언
deq.push_back(10); // 뒤에 추가
deq.pop_back(); // 뒤에 삭제
deq.push_front(20); // 앞으로 추가
deq.pop_front(); // 앞에 삭제
deq.resize(10, 0); // 초기화 : 10의 크기를 0으로 채움
deq[3] = 10; // 랜덤 접근
std::cout << deq[3] << std::endl; // 랜덤 접근
24
int nSum = 0;
for (int i = 0; i < deq.size(); i++)
{
nSum += vec[i];
}
// auto = std::vector<int>::iterator
for (auto it = deq.begin(); it != deq.end(); it++)
{
nSum += (*it);
}
26
27
28
29
#include <list>
std::list<int> lst;
lst.push_back(5); // 5
lst.push_back(10); // 5 -> 10
lst.push_front(1); // 1 -> 5 -> 10
auto it = lst.begin(); // 첫번째 위치, it -> 1 -> 5 -> 10
it++; // 두번째 위치, 1 -> it -> 5 -> 10
auto at = lst.insert(it, 2); // 2 삽입, 1 -> at -> 2 -> it -> 5 -> 10
lst.insert(at, 3); // 1 -> 3 -> at -> 2 -> it -> 5 -> 10
lst.insert(it, 4); // 1 -> 3 -> at -> 2 -> 4 -> it -> 5 -> 10
for (auto iter = lst.begin(); iter != lst.end(); iter++)
std::cout << (*iter) << 't';
30
std::list<int> lstB;
lstB.push_back(20); // 20
lstB.push_back(30); // 20 -> 30
// 1 -> 3 -> at -> 2 -> 4 -> it -> 5 -> 10
lst.insert(it, lstB.begin(), lstB.end());
// 1 -> 3 -> at -> 2 -> 4 -> 20 -> 30 -> it -> 5 -> 10
for (auto iter = lst.begin(); iter != lst.end(); iter++)
std::cout << (*iter) << 't';
std::cout << std::endl;

More Related Content

What's hot

[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling
Seok-joon Yun
 
Geveloper 160816
Geveloper 160816Geveloper 160816
Geveloper 160816
Nyeong Ahn
 
만들면서배우는Cocos2d-x(12-13)
만들면서배우는Cocos2d-x(12-13)만들면서배우는Cocos2d-x(12-13)
만들면서배우는Cocos2d-x(12-13)
Seungyup Choi
 
Es2015 Simple Overview
Es2015 Simple OverviewEs2015 Simple Overview
Es2015 Simple Overview
Kim Hunmin
 
6장 performance of game_최준혁_2
6장 performance of game_최준혁_26장 performance of game_최준혁_2
6장 performance of game_최준혁_2Mark Choi
 
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
Chris Ohk
 
Data Structure - 1st Study
Data Structure - 1st StudyData Structure - 1st Study
Data Structure - 1st Study
Chris Ohk
 
Hello c++ world
Hello c++ worldHello c++ world
Hello c++ world
. Ruvendix
 
바다 앱 개발 실패 노하우 1부
바다 앱 개발 실패 노하우 1부바다 앱 개발 실패 노하우 1부
바다 앱 개발 실패 노하우 1부
mosaicnet
 
2 1. variables & data types
2 1. variables & data types2 1. variables & data types
2 1. variables & data types웅식 전
 
Shellscript에 대하여
Shellscript에 대하여Shellscript에 대하여
Shellscript에 대하여
Luavis Kang
 
Startup JavaScript 3 - 조건문, 반복문, 예외처리
Startup JavaScript 3 - 조건문, 반복문, 예외처리Startup JavaScript 3 - 조건문, 반복문, 예외처리
Startup JavaScript 3 - 조건문, 반복문, 예외처리
Circulus
 
[JS] Function.prototype.bind
[JS] Function.prototype.bind[JS] Function.prototype.bind
[JS] Function.prototype.bind
Jinhyuck Kim
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
우영 주
 

What's hot (14)

[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling[KOSSA] C++ Programming - 13th Study - exception handling
[KOSSA] C++ Programming - 13th Study - exception handling
 
Geveloper 160816
Geveloper 160816Geveloper 160816
Geveloper 160816
 
만들면서배우는Cocos2d-x(12-13)
만들면서배우는Cocos2d-x(12-13)만들면서배우는Cocos2d-x(12-13)
만들면서배우는Cocos2d-x(12-13)
 
Es2015 Simple Overview
Es2015 Simple OverviewEs2015 Simple Overview
Es2015 Simple Overview
 
6장 performance of game_최준혁_2
6장 performance of game_최준혁_26장 performance of game_최준혁_2
6장 performance of game_최준혁_2
 
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
 
Data Structure - 1st Study
Data Structure - 1st StudyData Structure - 1st Study
Data Structure - 1st Study
 
Hello c++ world
Hello c++ worldHello c++ world
Hello c++ world
 
바다 앱 개발 실패 노하우 1부
바다 앱 개발 실패 노하우 1부바다 앱 개발 실패 노하우 1부
바다 앱 개발 실패 노하우 1부
 
2 1. variables & data types
2 1. variables & data types2 1. variables & data types
2 1. variables & data types
 
Shellscript에 대하여
Shellscript에 대하여Shellscript에 대하여
Shellscript에 대하여
 
Startup JavaScript 3 - 조건문, 반복문, 예외처리
Startup JavaScript 3 - 조건문, 반복문, 예외처리Startup JavaScript 3 - 조건문, 반복문, 예외처리
Startup JavaScript 3 - 조건문, 반복문, 예외처리
 
[JS] Function.prototype.bind
[JS] Function.prototype.bind[JS] Function.prototype.bind
[JS] Function.prototype.bind
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 

Similar to [KOSSA] C++ Programming - 15th Study - STL #1

ffmpeg optimization using CUDA
ffmpeg optimization using CUDAffmpeg optimization using CUDA
ffmpeg optimization using CUDA
yyooooon
 
2012 Ds D2 03
2012 Ds D2 032012 Ds D2 03
2012 Ds D2 03chl132435
 
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
Jaeseung Ha
 
프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기
Jongwook Choi
 
2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdf2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdfkd19h
 
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
명신 김
 
20150212 c++11 features used in crow
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crow
Jaeseung Ha
 
11. array & pointer
11. array & pointer11. array & pointer
11. array & pointer웅식 전
 
C++17 Key Features Summary - Ver 2
C++17 Key Features Summary - Ver 2C++17 Key Features Summary - Ver 2
C++17 Key Features Summary - Ver 2
Chris Ohk
 
[Swift] Data Structure - Graph(BFS)
[Swift] Data Structure - Graph(BFS)[Swift] Data Structure - Graph(BFS)
[Swift] Data Structure - Graph(BFS)
Bill Kim
 
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
DongMin Choi
 
Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택
JinTaek Seo
 
Functional programming
Functional programmingFunctional programming
Functional programming
ssuserdcfefa
 
2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdfjinwookhong
 
2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdfkd19h
 
MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)
MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)
MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)주영 송
 
포트폴리오에서 사용한 모던 C++
포트폴리오에서 사용한 모던 C++포트폴리오에서 사용한 모던 C++
포트폴리오에서 사용한 모던 C++
KWANGIL KIM
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)
NAVER D2
 
Data Structure. Linked List
Data Structure. Linked ListData Structure. Linked List
Data Structure. Linked List
Seung-chan Baeg
 
Bs webgl소모임002
Bs webgl소모임002Bs webgl소모임002
Bs webgl소모임002
Seonki Paik
 

Similar to [KOSSA] C++ Programming - 15th Study - STL #1 (20)

ffmpeg optimization using CUDA
ffmpeg optimization using CUDAffmpeg optimization using CUDA
ffmpeg optimization using CUDA
 
2012 Ds D2 03
2012 Ds D2 032012 Ds D2 03
2012 Ds D2 03
 
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
[NDC2015] C++11 고급 기능 - Crow에 사용된 기법 중심으로
 
프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기
 
2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdf2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdf
 
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14 불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
 
20150212 c++11 features used in crow
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crow
 
11. array & pointer
11. array & pointer11. array & pointer
11. array & pointer
 
C++17 Key Features Summary - Ver 2
C++17 Key Features Summary - Ver 2C++17 Key Features Summary - Ver 2
C++17 Key Features Summary - Ver 2
 
[Swift] Data Structure - Graph(BFS)
[Swift] Data Structure - Graph(BFS)[Swift] Data Structure - Graph(BFS)
[Swift] Data Structure - Graph(BFS)
 
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
 
Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf
 
2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf
 
MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)
MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)
MapReduce 실행 샘플 (K-mer Counting, K-means Clustering)
 
포트폴리오에서 사용한 모던 C++
포트폴리오에서 사용한 모던 C++포트폴리오에서 사용한 모던 C++
포트폴리오에서 사용한 모던 C++
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)
 
Data Structure. Linked List
Data Structure. Linked ListData Structure. Linked List
Data Structure. Linked List
 
Bs webgl소모임002
Bs webgl소모임002Bs webgl소모임002
Bs webgl소모임002
 

More from Seok-joon Yun

Retrospective.2020 03
Retrospective.2020 03Retrospective.2020 03
Retrospective.2020 03
Seok-joon Yun
 
Sprint & Jira
Sprint & JiraSprint & Jira
Sprint & Jira
Seok-joon Yun
 
Eks.introduce.v2
Eks.introduce.v2Eks.introduce.v2
Eks.introduce.v2
Seok-joon Yun
 
Eks.introduce
Eks.introduceEks.introduce
Eks.introduce
Seok-joon Yun
 
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image ConverterAWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
Seok-joon Yun
 
아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지
Seok-joon Yun
 
Pro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, PerformancePro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, Performance
Seok-joon Yun
 
Doing math with python.ch07
Doing math with python.ch07Doing math with python.ch07
Doing math with python.ch07
Seok-joon Yun
 
Doing math with python.ch06
Doing math with python.ch06Doing math with python.ch06
Doing math with python.ch06
Seok-joon Yun
 
Doing math with python.ch05
Doing math with python.ch05Doing math with python.ch05
Doing math with python.ch05
Seok-joon Yun
 
Doing math with python.ch04
Doing math with python.ch04Doing math with python.ch04
Doing math with python.ch04
Seok-joon Yun
 
Doing math with python.ch03
Doing math with python.ch03Doing math with python.ch03
Doing math with python.ch03
Seok-joon Yun
 
Doing mathwithpython.ch02
Doing mathwithpython.ch02Doing mathwithpython.ch02
Doing mathwithpython.ch02
Seok-joon Yun
 
Doing math with python.ch01
Doing math with python.ch01Doing math with python.ch01
Doing math with python.ch01
Seok-joon Yun
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
Seok-joon Yun
 
C++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threadsC++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threads
Seok-joon Yun
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
Seok-joon Yun
 
[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2
Seok-joon Yun
 
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
Seok-joon Yun
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4Seok-joon Yun
 

More from Seok-joon Yun (20)

Retrospective.2020 03
Retrospective.2020 03Retrospective.2020 03
Retrospective.2020 03
 
Sprint & Jira
Sprint & JiraSprint & Jira
Sprint & Jira
 
Eks.introduce.v2
Eks.introduce.v2Eks.introduce.v2
Eks.introduce.v2
 
Eks.introduce
Eks.introduceEks.introduce
Eks.introduce
 
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image ConverterAWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
 
아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지
 
Pro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, PerformancePro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, Performance
 
Doing math with python.ch07
Doing math with python.ch07Doing math with python.ch07
Doing math with python.ch07
 
Doing math with python.ch06
Doing math with python.ch06Doing math with python.ch06
Doing math with python.ch06
 
Doing math with python.ch05
Doing math with python.ch05Doing math with python.ch05
Doing math with python.ch05
 
Doing math with python.ch04
Doing math with python.ch04Doing math with python.ch04
Doing math with python.ch04
 
Doing math with python.ch03
Doing math with python.ch03Doing math with python.ch03
Doing math with python.ch03
 
Doing mathwithpython.ch02
Doing mathwithpython.ch02Doing mathwithpython.ch02
Doing mathwithpython.ch02
 
Doing math with python.ch01
Doing math with python.ch01Doing math with python.ch01
Doing math with python.ch01
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
C++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threadsC++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threads
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2
 
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
 

[KOSSA] C++ Programming - 15th Study - STL #1

  • 1.
  • 2.
  • 5. 5
  • 6. 6
  • 7. 7
  • 8. 8
  • 9.
  • 10. 10
  • 11.
  • 13.
  • 14. 14
  • 16. 16
  • 17. 17
  • 18. 18 #include <vector> // 해더 파일 std::vector<int> vec; // 선언 vec.push_back(10); // 추가 vec.pop_back(); // 삭제 vec.resize(10, 0); // 초기화 : 10의 크기를 0으로 채움 vec[3] = 10; // 랜덤 접근 std::cout << vec[3] << std::endl; // 랜덤 접근
  • 19. 19 int nSum = 0; for (int i = 0; i < vec.size(); i++) { nSum += vec[i]; } // auto = std::iterator<std::vector<int>> for (auto it = vec.begin(); it != vec.end(); it++) { nSum += (*it); }
  • 20.
  • 22. 22
  • 23. 23 #include <deque> // 해더 파일 std::deque<int> deq; // 선언 deq.push_back(10); // 뒤에 추가 deq.pop_back(); // 뒤에 삭제 deq.push_front(20); // 앞으로 추가 deq.pop_front(); // 앞에 삭제 deq.resize(10, 0); // 초기화 : 10의 크기를 0으로 채움 deq[3] = 10; // 랜덤 접근 std::cout << deq[3] << std::endl; // 랜덤 접근
  • 24. 24 int nSum = 0; for (int i = 0; i < deq.size(); i++) { nSum += vec[i]; } // auto = std::vector<int>::iterator for (auto it = deq.begin(); it != deq.end(); it++) { nSum += (*it); }
  • 25.
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29 #include <list> std::list<int> lst; lst.push_back(5); // 5 lst.push_back(10); // 5 -> 10 lst.push_front(1); // 1 -> 5 -> 10 auto it = lst.begin(); // 첫번째 위치, it -> 1 -> 5 -> 10 it++; // 두번째 위치, 1 -> it -> 5 -> 10 auto at = lst.insert(it, 2); // 2 삽입, 1 -> at -> 2 -> it -> 5 -> 10 lst.insert(at, 3); // 1 -> 3 -> at -> 2 -> it -> 5 -> 10 lst.insert(it, 4); // 1 -> 3 -> at -> 2 -> 4 -> it -> 5 -> 10 for (auto iter = lst.begin(); iter != lst.end(); iter++) std::cout << (*iter) << 't';
  • 30. 30 std::list<int> lstB; lstB.push_back(20); // 20 lstB.push_back(30); // 20 -> 30 // 1 -> 3 -> at -> 2 -> 4 -> it -> 5 -> 10 lst.insert(it, lstB.begin(), lstB.end()); // 1 -> 3 -> at -> 2 -> 4 -> 20 -> 30 -> it -> 5 -> 10 for (auto iter = lst.begin(); iter != lst.end(); iter++) std::cout << (*iter) << 't'; std::cout << std::endl;