C++ list insert

Jmnote (토론 | 기여)님의 2018년 4월 11일 (수) 23:28 판

1 개요

C++ 커서의 위치에 문자 삽입

C++ list insert

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

int main(){
	string s = "hell";

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

	l.insert(cursor, 'o');

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

2 같이 보기

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