"C++ list insert"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 하나는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;C++ 커서의 위치에 문자 삽입
;C++ 커서의 위치에 문자 삽입
C++ list insert
;C++ list insert
<source lang=C++>
<syntaxhighlight lang=C++>
#include <iostream>
#include <iostream>
#include <list>
#include <list>
23번째 줄: 23번째 줄:
}
}
// helloab
// helloab
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:47 기준 최신판

1 개요[ | ]

C++ 커서의 위치에 문자 삽입
C++ list insert
#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 같이 보기[ | ]

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