* 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 = { 114, 115, 116, 117, 119, 120, 130, 140, 150 } ; 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 |