OGLplus (0.52.0) a C++ wrapper for OpenGL

Ranges and range algorithms

Classes

struct  oglplus::ranges::IsRange< Range >
 Metafunction for checking if a type conforms to the oglplus::Range concept. More...
 
class  oglplus::ranges::AnyRange< Element >
 A type erasure for types conforming to the oglplus::Range concept. More...
 

Functions

template<typename Range , typename Func >
Func oglplus::ranges::ForEach (Range range, Func func)
 Executes a functor on every element in a range.
 
template<typename Range >
Range oglplus::ranges::Find (Range range, typename Range::ValueType value)
 Finds the specified value in a range. More...
 
template<typename Range , typename Predicate >
Range oglplus::ranges::FindIf (Range range, Predicate predicate)
 Finds the first a value satisfying a predicate in a range. More...
 
template<typename Range , typename Transf >
Transformed< Range, Transf > oglplus::ranges::Transform (Range range, Transf transf)
 Transforms a range by an unary function. More...
 
template<typename Range , typename State , typename Op >
State oglplus::ranges::Fold (Range range, State state, Op op)
 Folds the range by using a binary functor and a state value. More...
 
template<typename Range , typename Predicate >
Filtered< Range, Predicate > oglplus::ranges::OnlyIf (Range range, Predicate pred)
 Returns a range containing only elements satisfying a predicate. More...
 

Detailed Description

In situations where immutable ranges of elements need to be handled, OGLplus uses classes conforming to the Range concept. The main advantage of ranges is that basic algorithms working on them can be composed into complex ones more easily.

OGLplus also implements several algorithms for traversing or manipulating ranges and a type erasure for ranges.

Note
Range algorithms and utilities are not included by oglplus/all.hpp. To use them the oglplus/opt/ranges.hpp file must be included.

Function Documentation

template<typename Range >
Range oglplus::ranges::Find ( Range  range,
typename Range::ValueType  value 
)

Finds the specified value in a range.

This function traverses a range and stops either if the range is empty or if the specified value is found. The resulting range (either empty or having the specified value as the element at the front) is returned.

References oglplus::Range::Empty(), oglplus::Range::Front(), and oglplus::Range::Next().

template<typename Range , typename Predicate >
Range oglplus::ranges::FindIf ( Range  range,
Predicate  predicate 
)

Finds the first a value satisfying a predicate in a range.

This function traverses a range and stops either if the range is empty or if a value satisfying the predicate is found. The resulting range (either empty or having the found value as the element at the front) is returned.

template<typename Range , typename State , typename Op >
State oglplus::ranges::Fold ( Range  range,
State  state,
Op  op 
)

Folds the range by using a binary functor and a state value.

Fold updates the initial state by calling the binary operation on it and all elements in the range.

State state;
while(!range.Empty())
{
state = op(state, range.Front());
range.Next();
}

References oglplus::Range::Empty(), oglplus::Range::Front(), and oglplus::Range::Next().

template<typename Range , typename Predicate >
Filtered<Range, Predicate> oglplus::ranges::OnlyIf ( Range  range,
Predicate  pred 
)

Returns a range containing only elements satisfying a predicate.

OnlyIf returns a range that contains only those elements of the original range, which satisfy the specified predicate.

template<typename Range , typename Transf >
Transformed<Range, Transf> oglplus::ranges::Transform ( Range  range,
Transf  transf 
)

Transforms a range by an unary function.

Transform returns a range whose Front function returns the Front value of the original range transformed by transf.


Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).