mardi 24 mars 2015

How do you use std::not1 and std::not2?

Currently if you want to negate a predicate, you have to use a std::<algorithm>_if_not variant or a lambda. But for the sake of academics I want to know if this is possible:



std::string s("hello");
std::find_if(s.begin(), s.end(), std::not1(::ispunct));


Without writing my own function object, how to make this code work?


Aucun commentaire:

Enregistrer un commentaire