(C++) std::find\if\not
January 11, 2018 · View on GitHub
(C++) std::find_if_not
std::find_if_not is a C++11 algorithm to find an element in a container that does not satisfy a certain predicate.
#include <algorithm> #include <cassert> #include <vector> int main() { const std::vector<int> v = { 1,3,5,7,9,10,11,13,15,17,19 }; assert( *std::find_if_not( v.begin(),v.end(), [v](const int i) { return i%2; //An even number } ) == 10); }