* Computer Science/C++

c++ list splice

soicem 2018. 11. 1. 12:28

 iterator로 지정된 구간을 첫 파라미터의 위치로 옮기는 작업


1
2
3
4
5
6
7
8
9
10
11
12
13
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    list <int>  LLa = { 114115116117119120130140150 } ;
    list <int>::iterator it1, it2;
    it1 = LLa.begin() ; it1++ ;  it1++ ;  it1++ ;  it1++ ;
    it2 = it1; it2++; it2++; it2++;
    LLa.splice(LLa.end(), LLa, it1, it2) ;
    return 0;
}
 
 
cs


'* Computer Science > C++' 카테고리의 다른 글

hw13 meeting in pnu data structure class  (0) 2018.12.07
data structure homework8 in pnu ds class  (0) 2018.11.01
list 짝수, 홀수 분리하기  (0) 2018.10.31
vector 비교하기  (0) 2018.10.02
c++로 스플릿하기  (0) 2018.09.27