Skip to content

Latest commit

 

History

History
45 lines (26 loc) · 1.36 KB

CppStdNone_of.md

File metadata and controls

45 lines (26 loc) · 1.36 KB

 

 

 

 

 

 

std::none_of is an STL algorithm since the C++11 standard to check if none of the elements from a container satisfy a certain predicate.

 

 


#include <algorithm> #include <cassert> int main() {   //Create a std::vector with only positive values   const std::vector<int> v = { 0,1,2,3,4,5 };   //Assume none of these has a value smaller than zero   assert(std::none_of(v.begin(),v.end(),[](const int i){ return i < 0; } )); }