Lumiera  0.pre.03
»edit your freedom«
util-coll.hpp File Reference

Go to the source code of this file.

Description

Some small helpers and convenience shortcuts to ease working with collections and sequences (given by iterator).

Mostly, these are tiny bits of existing functionality, just packaged in a more fluent and readable way.

  • accessors
  • aggregate functions
    • util::max() compute the maximum of comparable numbers
    • util::min()
Warning
some functions only available when including itertools.hpp beforehand
See also
util-collection-test.cpp
util-foreach.hpp

Definition in file util-coll.hpp.

#include "lib/util.hpp"
#include "lib/meta/trait.hpp"
#include <limits>

Classes

struct  can_direct_access_Last< T >
 
struct  treat_as_LumieraIterator< T >
 
struct  treat_as_STL_Container< T >
 

Functions

template<typename COL >
void __ensure_nonempty (COL const &coll)
 
template<typename COLL , typename = enable_if< treat_as_STL_Container<COLL>>>
auto first (COLL const &coll)
 access the first element of a STL-like container. More...
 
template<typename IT , typename = enable_if<treat_as_LumieraIterator<IT>>>
auto first (IT ii)
 extract the first element yielded by an Lumiera Forward Iterator. More...
 
template<typename COLL , typename = enable_if< can_direct_access_Last<COLL>>>
auto last (COLL const &coll)
 access the last element of a STL-like container. More...
 
template<class IT >
auto max (IT &&elms)
 
template<class CON >
auto max (CON const &elms)
 
template<class IT >
auto min (IT &&elms)
 
template<class CON >
auto min (CON const &elms)
 

Namespaces

Function Documentation

◆ first() [1/2]

auto util::first ( COLL const &  coll)
inline

access the first element of a STL-like container.

Note
the container is taken by const& and the const is stripped before access.

Definition at line 102 of file util-coll.hpp.

References util::first().

Referenced by util::first().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ last()

auto util::last ( COLL const &  coll)
inline

access the last element of a STL-like container.

Note
the container is taken by const& and the const is stripped before access.
Examples:
/Werk/devel/lumi/src/lib/hetero-data.hpp.

Definition at line 117 of file util-coll.hpp.

References util::last().

Referenced by util::last().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ first() [2/2]

auto util::first ( IT  ii)
inline

extract the first element yielded by an Lumiera Forward Iterator.

Warning
the iterator is modified.

Definition at line 132 of file util-coll.hpp.

References util::first().

+ Here is the call graph for this function: