Lumiera  0.pre.03
»edit your freedom«
IterCursor< IT > Class Template Reference

#include "lib/iter-cursor.hpp"

Description

template<class IT>
class lib::IterCursor< IT >

A cursor-like iterator with the ability to switch iteration direction.

It can be built on top of any bidirectional STL iterator or similar entity, which has an -- operator. Initially, IterCursor will operate in forward direction; irrespective of the current direction, it always fulfils the iter-adapter.hppLumiera Forward Iterator"" concept, i.e. it can be iterated until exhaustion, in which case it will evaluate to bool(false).

Note
IterCursor instances can be equality compared, also taking the current direction into account. As a special case, all exhausted iterators are treated as equal.

Definition at line 166 of file iter-cursor.hpp.

Public Member Functions

 IterCursor (IterCursor &&)=default
 
 IterCursor (IterCursor const &)=default
 
template<class CON >
 IterCursor (CON &container)
 
 IterCursor (IT &&begin, IT &&end)
 
IterCursoroperator= (IterCursor &&)=default
 
IterCursoroperator= (IterCursor const &)=default
 
IterCursorswitchBackwards ()
 
IterCursorswitchDir ()
 change the orientation of iteration. More...
 
IterCursorswitchForwards ()
 
- Public Member Functions inherited from IterStateWrapper< iter::CursorGear< IT >::value_type, iter::CursorGear< IT > >
 IterStateWrapper (iter::CursorGear< IT > &&initialState)
 
 IterStateWrapper (iter::CursorGear< IT > const &initialState)
 
bool empty () const
 
 ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (IterStateWrapper)
 
bool isValid () const
 
 operator bool () const
 
reference operator* () const
 
IterStateWrapperoperator++ ()
 
pointer operator-> () const
 

Private Types

using _Core = iter::CursorGear< IT >
 
using _Parent = IterStateWrapper< typename _Core::value_type, _Core >
 

Additional Inherited Members

- Public Types inherited from IterStateWrapper< iter::CursorGear< IT >::value_type, iter::CursorGear< IT > >
typedef iter::CursorGear< IT >::value_type * pointer
 
typedef iter::CursorGear< IT >::value_type & reference
 
typedef iter::CursorGear< IT >::value_type value_type
 
- Protected Member Functions inherited from IterStateWrapper< iter::CursorGear< IT >::value_type, iter::CursorGear< IT > >
void __throw_if_empty () const
 
iter::CursorGear< IT > & stateCore ()
 allow derived classes to access state representation
 
iter::CursorGear< IT > const & stateCore () const
 

Member Function Documentation

◆ switchDir()

IterCursor& switchDir ( )
inline

change the orientation of iteration.

A forward oriented iteration will continue backwards, and vice versa. This operation can even be invoked on an already exhausted iterator, in which case it will turn back in reversed direction.

Definition at line 199 of file iter-cursor.hpp.

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

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