Mirror reflection library - Puddle compile-time layer 0.5.13
|
A range of Elements. More...
#include <puddle/doc/concepts.hpp>
Public Member Functions | |
Boolean | empty (void) const |
Returns true if the range is empty. | |
Integer | size (void) const |
Returns the number of elements in the range. | |
Range | step_front (void) const |
Returns a range without the first element of this range. | |
Element | front (void) const |
Returns the element at the front of the range. | |
Element | at (Index) const |
Returns the element at the specified Index. | |
template<int Index> | |
Element | at_c (void) const |
Returns the element at the specified Index. | |
template<class UnaryPredicate > | |
Range | only_if (UnaryPredicate pred) const |
Returns a new range containing only elements satisfying a predicate. | |
template<class Functor > | |
void | for_each (Functor func) const |
Executes a functor on every element in the range. | |
template<typename ResultType , class Functor , typename ValueType > | |
ResultType | accumulate (Functor func, ValueType init=ResultType()) const |
Accumulates the results of a functor called on every element. |
A range of Elements.
This class is a wrapper around the Mirror's compile time range.
ResultType puddle::Range< Element >::accumulate | ( | Functor | func, |
ValueType | init = ResultType() |
||
) | const |
Accumulates the results of a functor called on every element.
This function executes the specified functor on every element in the range and the result of previous invocation or the initial value. The functor must implement a function call operator with four parameters. The first parameter is of the ValueType type
void puddle::Range< Element >::for_each | ( | Functor | func | ) | const |
Executes a functor on every element in the range.
This function executes the specified functor on every element in this range. The functor must implement a function call operator with three parameters. The first parameter is of the Element type the second and third are booleans indicating the first and the last element in the traversal.
Range puddle::Range< Element >::step_front | ( | void | ) | const |
Returns a range without the first element of this range.
This function should not be called on empty ranges