C++ list insert

Jmnote (토론 | 기여)님의 2018년 4월 11일 (수) 23:26 판
C++ 커서의 위치에 문자 삽입

C++ list insert

#include <iostream>
#include <list>
#include <string>
using namespace std;

int main(){
	string s;
	cin >> s;

	list<char> l(s.begin(), s.end());
	auto cursor = l.end();

	l.insert(cursor, "pp");  //에러 발생

	for (auto v : l){
		cout << v;
	}
	cout << '\n';
}

같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}