Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
RangeIter< IT > Class Template Reference

#include "lib/iter-adapter.hpp"

Description

template<class IT>
class lib::RangeIter< IT >

Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapter is completely self-contained and allows to iterate once over the range of elements, until pos==end.

Thus, a custom container may expose a range of elements of an embedded STL container, without controlling the details of the iteration (as is possible using the more generic IterAdapter).

Note
  • when IT is just a pointer, we use the pointee as value type
  • but when IT is a class, we expect the usual STL style nested typedefs value_type, reference and pointer

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

Public Types

using pointer = _ValTrait::pointer
 
using reference = _ValTrait::reference
 
using value_type = std::remove_reference< reference >::type
 

Public Member Functions

 RangeIter (IT const &start, IT const &end)
 
 RangeIter ()
 
template<class I2 >
 RangeIter (I2 const &oIter)
 allow copy, when the underlying iterators are compatible or convertible
 
 operator bool () const
 
reference operator* () const
 
pointer operator-> () const
 
RangeIteroperator++ ()
 
bool isValid () const
 
bool empty () const
 
const IT & getPos () const
 access wrapped STL iterator
 
const IT & getEnd () const
 
 ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (RangeIter)
 

Private Types

using _ValTrait = meta::ValueTypeBinding< meta::remove_pointer_t< IT > >
 

Private Member Functions

void _maybe_throw () const
 

Private Attributes

IT p_
 
IT e_
 

Constructor & Destructor Documentation

◆ RangeIter() [1/3]

template<class IT >
RangeIter ( IT const &  start,
IT const &  end 
)
inline

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

◆ RangeIter() [2/3]

template<class IT >
RangeIter ( )
inline

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

◆ RangeIter() [3/3]

template<class IT >
template<class I2 >
RangeIter ( I2 const &  oIter)
inline

allow copy, when the underlying iterators are compatible or convertible

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

Member Typedef Documentation

◆ _ValTrait

template<class IT >
using _ValTrait = meta::ValueTypeBinding<meta::remove_pointer_t<IT> >
private

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

◆ pointer

template<class IT >
using pointer = _ValTrait::pointer

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

◆ reference

template<class IT >
using reference = _ValTrait::reference

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

◆ value_type

template<class IT >
using value_type = std::remove_reference<reference>::type
Note
special twist, since a STL const_iterator would yield a non-const value_type

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

Member Function Documentation

◆ operator bool()

template<class IT >
operator bool ( ) const
inlineexplicit

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

References RangeIter< IT >::isValid().

+ Here is the call graph for this function:

◆ operator*()

template<class IT >
reference operator* ( ) const
inline

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

References RangeIter< IT >::_maybe_throw(), and RangeIter< IT >::p_.

+ Here is the call graph for this function:

◆ operator->()

template<class IT >
pointer operator-> ( ) const
inline

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

References RangeIter< IT >::_maybe_throw().

+ Here is the call graph for this function:

◆ operator++()

template<class IT >
RangeIter & operator++ ( )
inline

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

References RangeIter< IT >::_maybe_throw(), and RangeIter< IT >::p_.

+ Here is the call graph for this function:

◆ isValid()

template<class IT >
bool isValid ( ) const
inline

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

References RangeIter< IT >::e_, and RangeIter< IT >::p_.

Referenced by RangeIter< IT >::_maybe_throw(), RangeIter< IT >::empty(), and RangeIter< IT >::operator bool().

+ Here is the caller graph for this function:

◆ empty()

template<class IT >
bool empty ( ) const
inline

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

References RangeIter< IT >::isValid().

+ Here is the call graph for this function:

◆ getPos()

template<class IT >
const IT & getPos ( ) const
inline

access wrapped STL iterator

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

References RangeIter< IT >::p_.

Referenced by lib::operator==().

+ Here is the caller graph for this function:

◆ getEnd()

template<class IT >
const IT & getEnd ( ) const
inline

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

References RangeIter< IT >::e_.

◆ ENABLE_USE_IN_STD_RANGE_FOR_LOOPS()

template<class IT >
ENABLE_USE_IN_STD_RANGE_FOR_LOOPS ( RangeIter< IT >  )

◆ _maybe_throw()

template<class IT >
void _maybe_throw ( ) const
inlineprivate

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

References RangeIter< IT >::isValid().

Referenced by RangeIter< IT >::operator*(), RangeIter< IT >::operator++(), and RangeIter< IT >::operator->().

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

Member Data Documentation

◆ p_

template<class IT >
IT p_
private

◆ e_

template<class IT >
IT e_
private

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

Referenced by RangeIter< IT >::getEnd(), and RangeIter< IT >::isValid().

+ Inheritance diagram for RangeIter< IT >:
+ Collaboration diagram for RangeIter< IT >:

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