Mirror reflection library - Lagoon run-time layer 0.5.13
|
Functions | |
template<typename ValueType , class... Ranges> | |
UnspecifiedRange< ValueType > | lagoon::chain (const Ranges &...ranges) |
Chains the ranges into a single range with a common ValueType. | |
template<typename Interface , class... Ranges> | |
UnspecifiedRange< shared < Interface > > | lagoon::chain_mo (const Ranges &...ranges) |
Chains the ranges into a single range with a common Interface. | |
template<class Range , typename Predicate > | |
bool | lagoon::contains (Range range, Predicate predicate) |
Searches a range for an element satisfying a predicate. | |
template<class Interface , class Range > | |
UnspecifiedRange< Interface > | lagoon::extract (const Range &metaobjects) |
Extracts only meta-objects with a particular interface. | |
template<class Range , typename Predicate > | |
Range | lagoon::find_if (Range range, Predicate predicate) |
Searches a range for an element satisfying a predicate. | |
UnspecifiedRange< shared < meta_named_scoped_object > > | lagoon::flatten (const shared< meta_scope > &scope) |
Get a range of all members of a scope including nested members. | |
UnspecifiedRange< shared < meta_named_scoped_object > > | lagoon::flatten_in_order (const shared< meta_scope > &scope) |
Get a range of all members of a scope including nested members. | |
template<typename State , class Range , typename BinaryOp > | |
State | lagoon::fold (Range range, State state, BinaryOp op) |
Accumulating the results of calling a binary functor on the elements. | |
template<typename State , class Range , typename BinaryOp > | |
State & | lagoon::fold_ref (Range range, State &state_ref, BinaryOp op) |
Accumulating the results of calling a binary functor on the elements. | |
template<typename State , class Range , typename InitialOp , typename DefaultOp , typename FinalOp > | |
State & | lagoon::fold_ref (Range range, State &state_ref, InitialOp initial, DefaultOp op, FinalOp final) |
Accumulating the results of calling a binary functor on the elements. | |
template<class Range , typename Functor > | |
Functor | lagoon::for_each (Range range, Functor func) |
Executes an unary functor on each element of a range. | |
template<class Range > | |
UnspecifiedRange | lagoon::limit (Range range, size_t count) |
Limits the range to contain maximum of n elements. | |
template<class Range > | |
UnspecifiedRange | lagoon::link (const std::initializer_list< Range > &ranges) |
Links the homogenous ranges into a single range. | |
template<class Range > | |
Range | lagoon::offset (Range range, size_t amount) |
Offsets the beginning of the range by N elements. | |
template<class Range , typename Predicate > | |
UnspecifiedRange | lagoon::only_if (Range range, Predicate predicate) |
Adapts the range to contain only elements satisfying a predicate. | |
template<class Range , typename SortProc > | |
UnspecifiedRange | lagoon::sort (Range range, SortProc sort_proc) |
Sorts the elements in the range by using a strict weak ordering proc. | |
template<class Range > | |
StdRange | lagoon::make_std_range (Range range) |
Adapts a Lagoon's range to have a begin() and end() functions. | |
template<class Range , typename Transform > | |
UnspecifiedRange | lagoon::transform (Range range, Transform transf) |
Transforms the elements in the range by a functor. | |
template<class Range , typename Predicate > | |
UnspecifiedRange | lagoon::until (Range range, Predicate predicate) |
Adapts the range to end when a predicate is satisfied. |
Lagoon provides an extensive set of utilities for tasks like range transformation, filtering, sorting, searching, etc. which make writing complex range manipulating algorithms easier and more straightforward.
UnspecifiedRange<ValueType> lagoon::chain | ( | const Ranges &... | ranges | ) |
Chains the ranges into a single range with a common ValueType.
Returns a single range that contains a sequence of elements from the provided ranges. The elements in the individual ranges must be convertible to ValueType
. The chained ranges may be of different types.
ValueType | the common type to be used for the elements of the chained ranges |
Ranges | the pack of range types to be chained |
ranges | the pack of ranges to be chained |
UnspecifiedRange<shared<Interface> > lagoon::chain_mo | ( | const Ranges &... | ranges | ) |
Chains the ranges into a single range with a common Interface.
Returns a single range that contains a sequence of shared meta-objects from the provided ranges. The elements in the individual ranges must have the specified Interface.
Interface | the common meta-object iterface to be used for the elements of the chained ranges |
Ranges | the pack of range types to be chained |
ranges | the pack of ranges to be chained |
bool lagoon::contains | ( | Range | range, |
Predicate | predicate | ||
) |
Searches a range for an element satisfying a predicate.
Traverses a range checking the result of a predicate on each element. Stops at the first element satisfying the predicate and returns true. If no such elements exists in the range returns false.
range | the range to be searched |
predicate | the predicate to be used on each element of the range |
UnspecifiedRange<Interface> lagoon::extract | ( | const Range & | metaobjects | ) |
Extracts only meta-objects with a particular interface.
Adapts the range so that it contains only meta-objects implementing the desired Interface. The interface of the meta-objects in the resulting range is cast to Interface
.
Interface | the desired interface |
metaobjects | the range or shared metaobjects to extract from |
Range lagoon::find_if | ( | Range | range, |
Predicate | predicate | ||
) |
Searches a range for an element satisfying a predicate.
Traverses a range checking the result of a predicate on each element. Stops at the first element satisfying the predicate and returns the resulting range.
range | the range to be searched |
predicate | the predicate to be used on each element of the range |
UnspecifiedRange<shared<meta_named_scoped_object> > lagoon::flatten | ( | const shared< meta_scope > & | scope | ) |
Get a range of all members of a scope including nested members.
This function returns a range of all members, including nested, of the scope passed as argument. No particular order of traversal is to be expected.
scope | the scope to be flattened |
UnspecifiedRange<shared<meta_named_scoped_object> > lagoon::flatten_in_order | ( | const shared< meta_scope > & | scope | ) |
Get a range of all members of a scope including nested members.
This function returns a range of all members, including nested, of the scope passed as argument. The members are traversed in the same order in which they were registered and nested members of a scope are ordered right after their parent scope.
scope | the scope to be flattened |
State lagoon::fold | ( | Range | range, |
State | state, | ||
BinaryOp | op | ||
) |
Accumulating the results of calling a binary functor on the elements.
Returns the result of successive application of a binary forward operation on the result of previous invocations and every element in the range.
range | the range to be folded |
state | the initial state used in the first invocation |
op | the functor to be called on each element of the range |
References Range< Element >::empty(), Range< Element >::front(), and Range< Element >::step_front().
State& lagoon::fold_ref | ( | Range | range, |
State & | state_ref, | ||
BinaryOp | op | ||
) |
Accumulating the results of calling a binary functor on the elements.
Returns the result of successive application of a binary forward operation on the result of previous invocations and every element in the range.
range | the range to be folded |
state_ref | reference to the state variable gradually modified by op |
op | the functor to be called on each element of the range |
References Range< Element >::empty(), Range< Element >::front(), and Range< Element >::step_front().
State& lagoon::fold_ref | ( | Range | range, |
State & | state_ref, | ||
InitialOp | initial, | ||
DefaultOp | op, | ||
FinalOp | final | ||
) |
Accumulating the results of calling a binary functor on the elements.
Returns the result of successive application of a binary forward operation on the result of previous invocations and every element in the range. This version uses three different binary functors; one for the first element, one for the last element and one for the remaining elements. If the range has only one element the initial functor is called.
range | the range to be folded |
state_ref | reference to the state variable gradually modified by op |
initial | the functor to be called on the first element of the range |
op | the functor to be called on each element of the range except the first and the last |
final | the functor to be called on the last element of the range |
References Range< Element >::empty(), Range< Element >::front(), and Range< Element >::step_front().
Functor lagoon::for_each | ( | Range | range, |
Functor | func | ||
) |
Executes an unary functor on each element of a range.
This function calls the func on each element of the range passed as the first argument
range | the range to be traversed |
func | the functor to be called on each element of the range |
References Range< Element >::empty(), Range< Element >::front(), and Range< Element >::step_front().
UnspecifiedRange lagoon::limit | ( | Range | range, |
size_t | count | ||
) |
Limits the range to contain maximum of n elements.
Adapts the range so that it contains maximally count elements or less if the adapted range is shorter
range | the range to be limited |
count | the upper limit of the count of elements |
UnspecifiedRange lagoon::link | ( | const std::initializer_list< Range > & | ranges | ) |
Links the homogenous ranges into a single range.
Returns a single range that contains a sequence of elements from the provided ranges. The ranges must have the same type.
Range | the type the of ranges to be linked |
ranges | the list of ranges to be linked |
StdRange lagoon::make_std_range | ( | Range | range | ) |
Adapts a Lagoon's range to have a begin() and end() functions.
This function transforms the interface of a Lagoon's range adding two member functions begin() and end() returning standard const input iterators usable by standard algorithms.
range | the range to be adapted |
Offsets the beginning of the range by N elements.
Adapts the range so that the front is moved by count elements or less if the adapted range is shorter. In the latter case the resulting range will be empty.
range | the range to be offset |
amount | the numer of elements to offset the range by |
UnspecifiedRange lagoon::only_if | ( | Range | range, |
Predicate | predicate | ||
) |
Adapts the range to contain only elements satisfying a predicate.
Traverses a range checking the result of a predicate on each element. Skips the elements not satisfying the predicate.
range | the range to be searched |
predicate | the predicate to be used to filter the range |
UnspecifiedRange lagoon::sort | ( | Range | range, |
SortProc | sort_proc | ||
) |
Sorts the elements in the range by using a strict weak ordering proc.
Returns a range containing the elements of the original range sorted by the binary strict weak ordering functor.
range | the range to be sorted |
sort_proc | the functor sorting the elements |
UnspecifiedRange lagoon::transform | ( | Range | range, |
Transform | transf | ||
) |
Transforms the elements in the range by a functor.
Returns a range containing the elements of the original range transformed by the unary functor.
range | the range to be transformed |
transf | the functor transforming the elements |
UnspecifiedRange lagoon::until | ( | Range | range, |
Predicate | predicate | ||
) |
Adapts the range to end when a predicate is satisfied.
Range | The type of the underlying range |
Predicate | The type of the terminating predicate |
range | the underlying range |
predicate | the predicate whose satisfying stops the traversal |