1 개요[ | ]
- C++ 커서의 위치에 문자 삽입
- C++ list insert
C
Copy
#include <iostream>
#include <list>
#include <string>
using namespace std;
int main(){
string s = "hello";
list<char> l(s.begin(), s.end());
auto cursor = l.end();
l.insert(cursor, 'a');
l.insert(cursor, 'b');
for (auto v : l) {
cout << v;
}
cout << '\n';
}
// helloab
2 같이 보기[ | ]
편집자 Taewon Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.