Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
InplacePreIterator< I, T > Class Template Reference

#include <elm/iter.h>

Public Types

typedef T t
 

Public Member Functions

bool operator() () const
 
bool operator! () const
 
const T & operator* () const
 
const T & operator-> () const
 
I & operator++ ()
 
void operator++ (int)
 
bool operator== (const I &i) const
 
bool operator!= (const I &i) const
 

Public Attributes

const typedef T & return_t
 

Detailed Description

template<class I, class T>
class elm::InplacePreIterator< I, T >

As PreIterator, this class is an helper in the writing of iterators but instead of returning the iterated items, it returns a constant reference to the iterated items.

Its aims to avoid redefining all iterator operators each time an operator is defined. The user of this class has just to define four methods:

  • bool ended() const – that returns true when the iteration ends,
  • bool equals(const Iterator& i) const – to test if two iterators are equal,
  • void next() – to move to the next item,
  • const T& item() const – to get the current item (if any).

Using these 4 functions, PreIterator is able to support the operators (), !, ++ (prefix), ++ (suffix), *, ->, == and !=.

Parameters
IType of the defined iterator.
TType of the items.
Deprecated:
Used PreIterator with reference/non-reference item type.

Member Typedef Documentation

◆ t

typedef T t

Member Function Documentation

◆ operator!()

bool operator! ( ) const
inline

◆ operator!=()

bool operator!= ( const I &  i) const
inline

◆ operator()()

bool operator() ( ) const
inline

◆ operator*()

const T& operator* ( ) const
inline

◆ operator++() [1/2]

I& operator++ ( )
inline

◆ operator++() [2/2]

void operator++ ( int  )
inline

◆ operator->()

const T& operator-> ( ) const
inline

◆ operator==()

bool operator== ( const I &  i) const
inline

Member Data Documentation

◆ return_t

const typedef T& return_t

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