Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Perform operations "for each element" of a collection.
This header defines various flavours of these active iteration functions, which all take a functor and invoke it in some way over the collection's elements.
begin()
and end()
const&
– but the const is stripped silently.Thus, within the iteration, the function passed in can modify the original collection. If you pass in a ref to a temporary, the compiler won't complain. Moreover, several kinds of wrappers are also stripped silently, including reference_wrapper, shared_ptr and lumiera::P. The rationale for this non-standard behaviour is to allow convenient writing of in-line iteration, where even the collection to iterate is yielded by function call.
Definition in file util-foreach.hpp.
Functions | |
template<typename IT , typename FUN > | |
bool | and_all (IT i, IT end, FUN predicate) |
All quantification: check if all elements of a collection satisfy the given predicate. More... | |
template<typename Container , typename FUN > | |
enable_if< can_STL_ForEach< Container >, bool > | and_all (Container const &coll, FUN predicate) |
template<typename IT , typename FUN > | |
enable_if< can_IterForEach< IT >, bool > | and_all (IT const &ii, FUN predicate) |
template<typename CON , typename FUN , typename P1 , typename... ARGS> | |
bool | and_all (CON const &elements, FUN function, P1 &&bind1, ARGS &&...args) |
Accept binding for arbitrary function arguments. More... | |
template<typename Container , typename FUN > | |
disable_if< can_IterForEach< Container >, FUN > | for_each (Container const &coll, FUN doIt) |
operate on all elements of a STL container. More... | |
template<typename IT , typename FUN > | |
enable_if< can_IterForEach< IT >, FUN > | for_each (IT const &ii, FUN doIt) |
operate on a Lumiera Forward Iterator until exhaustion. More... | |
template<typename CON , typename FUN , typename P1 , typename... ARGS> | |
void | for_each (CON const &elements, FUN function, P1 &&bind1, ARGS &&...args) |
Accept binding for arbitrary function arguments. More... | |
template<typename IT , typename FUN > | |
bool | has_any (IT i, IT end, FUN predicate) |
Existential quantification: check if any element of a collection satisfies the given predicate. More... | |
template<typename Container , typename FUN > | |
enable_if< can_STL_ForEach< Container >, bool > | has_any (Container const &coll, FUN predicate) |
template<typename IT , typename FUN > | |
enable_if< can_IterForEach< IT >, bool > | has_any (IT const &ii, FUN predicate) |
template<typename CON , typename FUN , typename P1 , typename... ARGS> | |
bool | has_any (CON const &elements, FUN function, P1 &&bind1, ARGS &&...args) |
Accept binding for arbitrary function arguments. More... | |
|
inline |
All quantification: check if all elements of a collection satisfy the given predicate.
Actually a short-circuit evaluation is performed.
Definition at line 69 of file util-foreach.hpp.
References util::and_all().
Referenced by util::and_all().
|
inline |
Existential quantification: check if any element of a collection satisfies the given predicate.
Actually, a short-circuit evaluation is performed.
Definition at line 85 of file util-foreach.hpp.
References util::has_any().
Referenced by util::has_any().
|
inline |
operate on all elements of a STL container.
const&
and the const
is stripped before iteration. and_all
Definition at line 113 of file util-foreach.hpp.
References util::for_each().
Referenced by util::for_each().
|
inline |
operate on a Lumiera Forward Iterator until exhaustion.
Definition at line 129 of file util-foreach.hpp.
References util::for_each().
|
inline |
Accept binding for arbitrary function arguments.
Definition at line 199 of file util-foreach.hpp.
References util::for_each().
|
inline |
Accept binding for arbitrary function arguments.
Definition at line 212 of file util-foreach.hpp.
References util::and_all().
|
inline |
Accept binding for arbitrary function arguments.
Definition at line 225 of file util-foreach.hpp.
References util::has_any().