SCGH SCGH - 1 year ago 89
Python Question

C++11 equivalent to Python's all() function

Is there an equivalent function to Python's

built-in function?

In other words: Does a C++11 function exist that returns
when all of the elements of an iterable meet a certain condition and

Answer Source

Check out std::all_of in the <algorithm> header. You can pass a custom predicate that evaluates to true or false on each element.