Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
NumIter< INT > Class Template Reference

#include "lib/iter-adapter.hpp"

Description

template<typename INT>
class lib::NumIter< INT >

Enumerate all "numbers" within a range.

This allows to build pipelines based on all numbers "for `i` from `1...N`". This range is half open, i.e. the start is inclusive and the end point is exclusive.

Remarks
default constructed iters are empty and compare equal with any other exhausted NumIter; essential requirement for a Lumiera Forward Iterator (allows use in range-for-loops).
Template Parameters
INTa number like type, which can be incremented and compared.
Note
deliberately yields by-value and has no operator->

Definition at line 920 of file iter-adapter.hpp.

Public Types

using pointer = INT *
 
using reference = INT &
 
using value_type = INT
 

Public Member Functions

 NumIter (INT start, INT end)
 
template<typename X >
 NumIter (X &&start, X &&end)
 
 NumIter ()
 
 operator bool () const
 
value_type operator* () const
 
NumIteroperator++ ()
 
bool isValid () const
 
bool empty () const
 
INT & getPos () const
 access wrapped index elements
 
INT & getEnd () const
 
 ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (NumIter)
 
bool operator!= (NumIter const &o) const
 Supporting equality comparisons...
 
bool operator== (NumIter const &o) const
 

Private Member Functions

void _maybe_throw () const
 

Private Attributes

INT i_
 
INT e_
 

Constructor & Destructor Documentation

◆ NumIter() [1/3]

template<typename INT >
NumIter ( INT  start,
INT  end 
)
inline

Definition at line 930 of file iter-adapter.hpp.

◆ NumIter() [2/3]

template<typename INT >
template<typename X >
NumIter ( X &&  start,
X &&  end 
)
inline

Definition at line 936 of file iter-adapter.hpp.

◆ NumIter() [3/3]

template<typename INT >
NumIter ( )
inline

Definition at line 941 of file iter-adapter.hpp.

Member Typedef Documentation

◆ pointer

template<typename INT >
using pointer = INT*

Definition at line 926 of file iter-adapter.hpp.

◆ reference

template<typename INT >
using reference = INT&

Definition at line 927 of file iter-adapter.hpp.

◆ value_type

template<typename INT >
using value_type = INT

Definition at line 928 of file iter-adapter.hpp.

Member Function Documentation

◆ operator bool()

template<typename INT >
operator bool ( ) const
inlineexplicit

Definition at line 949 of file iter-adapter.hpp.

References NumIter< INT >::isValid().

+ Here is the call graph for this function:

◆ operator*()

template<typename INT >
value_type operator* ( ) const
inline

Definition at line 959 of file iter-adapter.hpp.

References NumIter< INT >::_maybe_throw(), and NumIter< INT >::i_.

+ Here is the call graph for this function:

◆ operator++()

template<typename INT >
NumIter & operator++ ( )
inline

Definition at line 966 of file iter-adapter.hpp.

References NumIter< INT >::_maybe_throw(), and NumIter< INT >::i_.

+ Here is the call graph for this function:

◆ isValid()

template<typename INT >
bool isValid ( ) const
inline

Definition at line 974 of file iter-adapter.hpp.

References NumIter< INT >::e_, and NumIter< INT >::i_.

Referenced by NumIter< INT >::_maybe_throw(), NumIter< INT >::empty(), and NumIter< INT >::operator bool().

+ Here is the caller graph for this function:

◆ empty()

template<typename INT >
bool empty ( ) const
inline

Definition at line 980 of file iter-adapter.hpp.

References NumIter< INT >::isValid().

Referenced by NumIter< INT >::operator==().

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

◆ getPos()

template<typename INT >
INT & getPos ( ) const
inline

access wrapped index elements

Definition at line 987 of file iter-adapter.hpp.

References NumIter< INT >::i_.

◆ getEnd()

template<typename INT >
INT & getEnd ( ) const
inline

Definition at line 988 of file iter-adapter.hpp.

References NumIter< INT >::e_.

◆ ENABLE_USE_IN_STD_RANGE_FOR_LOOPS()

template<typename INT >
ENABLE_USE_IN_STD_RANGE_FOR_LOOPS ( NumIter< INT >  )

◆ operator!=()

template<typename INT >
bool operator!= ( NumIter< INT > const &  o) const
inline

Supporting equality comparisons...

Definition at line 995 of file iter-adapter.hpp.

References NumIter< INT >::operator==().

+ Here is the call graph for this function:

◆ operator==()

template<typename INT >
bool operator== ( NumIter< INT > const &  o) const
inline

Definition at line 996 of file iter-adapter.hpp.

References NumIter< INT >::e_, NumIter< INT >::empty(), and NumIter< INT >::i_.

Referenced by NumIter< INT >::operator!=().

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

◆ _maybe_throw()

template<typename INT >
void _maybe_throw ( ) const
inlineprivate

Definition at line 1001 of file iter-adapter.hpp.

References NumIter< INT >::isValid().

Referenced by NumIter< INT >::operator*(), and NumIter< INT >::operator++().

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

Member Data Documentation

◆ i_

◆ e_

template<typename INT >
INT e_
private
+ Collaboration diagram for NumIter< INT >:

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