Hi,
Right now, I have this code:
bool isAnyTrue() {
for(std::list< boost::shared_ptr<Foo> >::iterator i = mylist.begin(); i != mylist.end(); ++i) {
if( (*i)->isTrue() )
return true;
}
return false;
}
I have used Boost here and then but I couldn't really remember any simple way to write it somewhat like I would maybe write it in Python, e.g.:
def isAnyTrue():
return any(o.isTrue() for o in mylist)
Is there any construct in STL/Boost to write it more or less like this?
Or maybe an equivalent to this Python Code:
def isAnyTrue():
return any(map(mylist, lambda o: o.isTrue()))
Mostly I am wondering if there is any existing any
(and all
) equivalent in Boost / STL yet. Or why there is not (because it seems quite useful and I use it quite often in Python).