[C++] includes
Updated:
개요
- 정렬된 두 범위에 대해 한쪽에 다른 한쪽이 포함되는지 확인
예제
- 코드
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { vector<int> v1{5, 2, 3, 4, 1}; vector<int> v2{3, 5, 1}; sort(v1.begin(), v1.end()); sort(v2.begin(), v2.end()); cout << includes(v1.begin(), v1.end(), v2.begin(), v2.end()) << endl; cout << includes(v2.begin(), v2.end(), v1.begin(), v1.end()) << endl; return 0; }
- 실행 결과
1 0