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 >
enable_if< treat_as_STL_Container< COLL >, typename COLL::reference > first (COLL const &coll)
 access the first element of a STL-like container. More...
 
template<typename IT >
enable_if< treat_as_LumieraIterator< IT >, typename IT::reference > first (IT ii)
 extract the first element yielded by an Lumiera Forward Iterator. More...
 
template<typename COLL >
enable_if< can_direct_access_Last< COLL >, typename COLL::reference > 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]

enable_if< treat_as_STL_Container<COLL>, typename COLL::reference > 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 112 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()

enable_if< can_direct_access_Last<COLL>, typename COLL::reference > 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.

Definition at line 128 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]

enable_if< treat_as_LumieraIterator<IT>, typename IT::reference > util::first ( IT  ii)
inline

extract the first element yielded by an Lumiera Forward Iterator.

Warning
the iterator is modified.

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

References util::first().

+ Here is the call graph for this function: