![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
Perform operations "for each element" of a collection. More...
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.
Namespaces | |
| namespace | util |
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. | |
| 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. | |
| 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. | |
| 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. | |
| 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 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> | |
| void | for_each (CON const &elements, FUN function, P1 &&bind1, ARGS &&...args) |
| Accept binding for arbitrary function arguments. | |
| 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. | |
| 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. | |