Evo C++ Library v0.5.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IteratorBase< T > Class Template Reference

#include <evo/impl/iter.h>

Inheritance diagram for IteratorBase< T >:
Inheritance graph
[legend]

Detailed Description

template<class T>
class evo::IteratorBase< T >

Base iterator (used internally).

Iterator Types
  • IteratorFw Forward iterator
  • IteratorBi Bidirectional (forward and reverse) iterator
  • IteratorRa Random access (forward, reverse, and random access) iterator

Public Types

typedef IteratorBase< const T > Const
 Const iterator type. More...
 
typedef StaticIf< IsConst< T >::value, const typename T::IterItem, typename T::IterItem >::Type Item
 Iterator item type. More...
 
typedef IteratorBase< T > IterBaseType
 Iterator base type for parameter passing. More...
 
typedef T::IterKey Key
 Iterator key type. More...
 
typedef IteratorBase< typename RemoveConst< T >::Type > Mutable
 Mutable iterator type. More...
 
typedef T::Size Size
 Size type to use. More...
 
typedef T Target
 Iterator target type. More...
 
typedef StaticIf< IsConst< T >::value, Mutable, Const >::Type ToggleConst
 Used for converting between Const/Mutable iterators. More...
 

Public Member Functions

 IteratorBase (T &obj)
 Constructor. More...
 
 IteratorBase (T &obj, const Key &key, Item *data)
 Constructor. More...
 
 IteratorBase (const IterBaseType &src)
 Copy constructor. More...
 
 operator SafeBoolType () const
 Safe (explicit) evaluation as bool type. More...
 
bool operator! () const
 Check whether iterator is at end (not valid). More...
 
bool operator!= (const IterBaseType &iter) const
 Inequality operator. More...
 
template<typename T_ >
bool operator!= (const IteratorBase< T_ > &oth) const
 Check inequality with another iterator. More...
 
Item & operator* ()
 Dereference iterator to get item data reference. More...
 
Item * operator-> ()
 Dereference iterator to access data member. More...
 
IterBaseType & operator= (const IterBaseType &src)
 Copy/Assignment operator to copy from source iterator. More...
 
IterBaseType & operator= (const ToggleConst &src)
 Assignment operator to copy from source iterator. More...
 
IterBaseType & operator= (T &obj)
 Assignment operator to reset with new object, at end. More...
 
IterBaseType & operator= (IteratorPos pos)
 Assignment operator to set position. More...
 
bool operator== (const IterBaseType &iter) const
 Equality operator. More...
 
template<typename T_ >
bool operator== (const IteratorBase< T_ > &oth) const
 Check equality with another iterator. More...
 

Static Public Member Functions

static const IterBaseType & end ()
 Get iterator at end position. More...
 

Protected Member Functions

 IteratorBase ()
 Constructor (used internally). More...
 
 IteratorBase (T *obj)
 Constructor (used internally). More...
 

Protected Attributes

Item * data_
 Item pointer. More...
 
bool end_
 End flag. More...
 
Key key_
 Iterator key. More...
 
T * obj_
 Container object pointer. More...
 

Member Typedef Documentation

◆ Const

typedef IteratorBase<const T> Const

Const iterator type.

◆ Item

typedef StaticIf< IsConst<T>::value, const typename T::IterItem, typename T::IterItem >::Type Item

Iterator item type.

◆ IterBaseType

Iterator base type for parameter passing.

◆ Key

typedef T::IterKey Key

Iterator key type.

◆ Mutable

typedef IteratorBase<typename RemoveConst<T>::Type> Mutable

Mutable iterator type.

◆ Size

typedef T::Size Size

Size type to use.

◆ Target

typedef T Target

Iterator target type.

◆ ToggleConst

typedef StaticIf<IsConst<T>::value,Mutable,Const>::Type ToggleConst

Used for converting between Const/Mutable iterators.

Constructor & Destructor Documentation

◆ IteratorBase() [1/5]

IteratorBase ( T &  obj)
inlineexplicit

Constructor.

This sets iterator to end.

Parameters
objContainer object to iterate through

◆ IteratorBase() [2/5]

IteratorBase ( T &  obj,
const Key &  key,
Item *  data 
)
inline

Constructor.

This initializes iterator with given position data.

Parameters
objContainer object to iterate through
keyIterator key to set
dataIterator data pointer to set

◆ IteratorBase() [3/5]

IteratorBase ( const IterBaseType &  src)
inline

Copy constructor.

Parameters
srcSource iterator to copy

◆ IteratorBase() [4/5]

IteratorBase ( )
inlineexplicitprotected

Constructor (used internally).

◆ IteratorBase() [5/5]

IteratorBase ( T *  obj)
inlineexplicitprotected

Constructor (used internally).

Only initializes object pointer.

Parameters
objPointer to container object (must not be NULL).

Member Function Documentation

◆ end()

static const IterBaseType& end ( )
inlinestatic

Get iterator at end position.

◆ operator SafeBoolType()

operator SafeBoolType ( ) const
inlineinherited

Safe (explicit) evaluation as bool type.

  • This is called when object is directly evaluated as a bool, and is equivalent to: !operator!()
  • See SafeBool

◆ operator!()

bool operator! ( ) const
inline

Check whether iterator is at end (not valid).

Returns
Whether at end

◆ operator!=() [1/2]

bool operator!= ( const IterBaseType &  iter) const
inline

Inequality operator.

Parameters
iterIterator to compare
Returns
Whether not equal

◆ operator!=() [2/2]

bool operator!= ( const IteratorBase< T_ > &  oth) const
inline

Check inequality with another iterator.

Parameters
othOther iterator to check against.
Returns
Whether inequal.

◆ operator*()

Item& operator* ( )
inline

Dereference iterator to get item data reference.

  • Iterator must be valid (not at end position)
Returns
Reference to current item data

◆ operator->()

Item* operator-> ( )
inline

Dereference iterator to access data member.

  • Iterator must be valid (not at end position)
Returns
Reference to current item data

◆ operator=() [1/4]

IterBaseType& operator= ( const IterBaseType &  src)
inline

Copy/Assignment operator to copy from source iterator.

Parameters
srcSource iterator to copy
Returns
This

◆ operator=() [2/4]

IterBaseType& operator= ( const ToggleConst &  src)
inline

Assignment operator to copy from source iterator.

  • This allows assigning a mutable iterator to a const iterator
  • This triggers a compiler error on attempt to assign a const iterator to a mutable iterator
Parameters
srcSource iterator to copy.
Returns
This.

◆ operator=() [3/4]

IterBaseType& operator= ( T &  obj)
inline

Assignment operator to reset with new object, at end.

Parameters
objContainer object to iterate through
Returns
This

◆ operator=() [4/4]

IterBaseType& operator= ( IteratorPos  pos)
inline

Assignment operator to set position.

Parameters
posPosition to set – ignored, sets to end
Returns
This

◆ operator==() [1/2]

bool operator== ( const IterBaseType &  iter) const
inline

Equality operator.

Parameters
iterIterator to compare
Returns
Whether equal

◆ operator==() [2/2]

bool operator== ( const IteratorBase< T_ > &  oth) const
inline

Check equality with another iterator.

Parameters
othOther iterator to check against.
Returns
Whether equal.

Member Data Documentation

◆ data_

Item* data_
protected

Item pointer.

◆ end_

bool end_
protected

End flag.

◆ key_

Key key_
protected

Iterator key.

◆ obj_

T* obj_
protected

Container object pointer.


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