C++ 리스트

Jmnote (토론 | 기여)님의 2018년 4월 14일 (토) 16:38 판

1 개요

C++ list
C++ 리스트
#include <iostream>
#include <list>

using namespace std;

int main() {
	list<int> l = { 3, 1, 4, 8 };
	for (int n : l) {
	    std::cout << n << '\n';
	}
}
// 3
// 1
// 4
// 8
#include <iostream>
#include <list>

using namespace std;

int main() {
	list<int> l = { 3, 1, 4, 8 };
	l.push_front(5);
	l.push_back(6);
	for (int n : l) {
	    std::cout << n << '\n';
	}
}
// 5
// 3
// 1
// 4
// 8
// 6

2 같이 보기

3 참고

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