...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
For a sequence seq
and
unary function object f
,
all
returns true if
f
returns true for every
element of seq
.
template<
typename Sequence,
typename F
>
typename result_of::all
<Sequence,F>::type all(
Sequence const& seq, F f);
Table 1.50. Parameters
Parameter |
Requirement |
Description |
---|---|---|
|
A model of Forward
Sequence, |
The sequence to search |
|
A unary function object |
The search predicate |
all
(seq, f);
Return type: bool
Semantics: Returns true if and only
if f(e)
evaluates to true
for every
element e
in seq
.
Linear. At most
comparisons.
result_of::size
<Sequence>::value
#include <boost/fusion/algorithm/query/all.hpp> #include <boost/fusion/include/all.hpp>
struct odd { template<typename T> bool operator()(T t) const { return t % 2; } }; ... assert(all
(make_vector
(1,3), odd())); assert(!all
(make_vector
(1,2), odd()));