"C++ 집합을 벡터로 변환"의 두 판 사이의 차이

(새 문서: ==개요== ;C++ set to vector <syntaxhighlight lang='console'> #include <iostream> #include <set> #include <vector> using namespace std; int main() { set<int> s = {1,3,5,7};...)
 
1번째 줄: 1번째 줄:
==개요==
==개요==
;C++ set to vector
;C++ set to vector
;C++ 집합을 벡터로 변환


<syntaxhighlight lang='console'>
<syntaxhighlight lang='cpp' run>
#include <iostream>
#include <iostream>
#include <set>
#include <set>

2023년 12월 17일 (일) 00:30 판

1 개요

C++ set to vector
C++ 집합을 벡터로 변환
#include <iostream>
#include <set>
#include <vector>
using namespace std;

int main() {
    set<int> s = {1,3,5,7};
    vector<int> v;
    for(const auto& el: s) v.push_back(el);
    for(const auto& el: v) cout << el << ' '; // 1 3 5 7 
}

2 같이 보기

3 참고

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