Mirror reflection library - Puddle compile-time layer 0.5.13

puddle::Range< Element > Struct Template Reference

A range of Elements. More...

#include <puddle/doc/concepts.hpp>

List of all members.

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.

Detailed Description

template<typename Element>
struct puddle::Range< Element >

A range of Elements.

This class is a wrapper around the Mirror's compile time range.

See also:
mirror::mp::range

Member Function Documentation

template<typename Element>
template<typename ResultType , class Functor , typename ValueType >
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

  • the previous or initial value, the second has the Element type, the third and fourth are booleans indicating the first and the last element in the traversal.
See also:
accumulate
template<typename Element>
template<class Functor >
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.

See also:
accumulate
template<typename Element>
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


The documentation for this struct was generated from the following file:

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.