c++

std::all_of, std::any_of, std::none_of

에브리피플 2015. 1. 7. 15:43

#include <algorithm>

std::vector<int> vInt;

for ( int i = 0; i < 10; i++ )

{

vInt.push_back(10);

}

auto check = std::all_of( vInt.begin(), vInt.end(), [](int i) 

return i >= 5 ? true : false; 

});

std::all_of : 범위에 있는 모든 요소가 조건에 만족한다면

std::any_of : 범위에 있는 요소 중에 한 개라도 조건을 만족한다면

std::none_of : 범위에 있는 요소 중에 한 개라도 조건을 만족하지 않는다면