ThePEG::DIterator< BaseIterator > Class Template Reference

DIterator is an iterator adaptor class. More...

#include <DIterator.h>

List of all members.

Public Types

typedef std::iterator_traits
< BaseIterator > 
Traits
 Forward typedef from underlying iterator.
typedef Traits::iterator_category iterator_category
 Forward typedef from underlying iterator.
typedef Traits::difference_type difference_type
 Forward typedef from underlying iterator.
typedef Traits::value_type PtrType
 Forward typedef from underlying iterator.
typedef std::iterator_traits
< PtrType
PtrTraits
 Forward typedef from underlying iterator.
typedef PtrTraits::value_type value_type
 Forward typedef from underlying iterator.
typedef PtrTraits::pointer pointer
 Forward typedef from underlying iterator.
typedef PtrTraits::reference reference
 Forward typedef from underlying iterator.

Public Member Functions

 DIterator (const BaseIterator &in)
 Constructor from a normal iterator.
 DIterator (const DIterator &pi)
 Copy constructor.
reference operator* () const
 Dereference the pointer referred to by the underlying iterator.
pointer operator-> () const
 Select member from the pointer referred to by the underlying iterator.
DIteratoroperator= (const DIterator &pi)
 Standard assignment operator.
DIteratoroperator= (const BaseIterator &pi)
 Assignment from a a normal iterator.
reference operator[] (difference_type n)
 Select a pointer with the given index and return a reference to the object pointed to.
difference_type operator- (const DIterator &pi)
 Return the distance to the given iterator.
Increment and decrement operators.
DIteratoroperator++ ()
 Pre increment the underlying iterator.
DIterator operator++ (int)
 Post increment the underlying iterator.
DIteratoroperator-- ()
 Pre decrement the underlying iterator.
DIterator operator-- (int)
 Post decrement the underlying iterator.
DIteratoroperator+= (int n)
 Jump forward n steps.
DIterator operator+ (int n)
 Get an iterator n steps forward.
DIteratoroperator-= (int n)
 Jump backward n steps.
DIterator operator- (int n)
 Get an iterator n steps backward.
Comparison operators.
bool operator== (const DIterator &pi)
 Test for equality.
bool operator!= (const DIterator &pi)
 Test for inequality.
bool operator< (const DIterator &pi)
 Test for less.
bool operator> (const DIterator &pi)
 Test for greater.
bool operator<= (const DIterator &pi)
 Test for less or equal.
bool operator>= (const DIterator &pi)
 Test for greater or equal.
bool operator== (const BaseIterator &bi)
 Test for equality.
bool operator!= (const BaseIterator &bi)
 Test for inequality.
bool operator< (const BaseIterator &bi)
 Test for less.
bool operator> (const BaseIterator &bi)
 Test for greater.
bool operator<= (const BaseIterator &bi)
 Test for less or equal.
bool operator>= (const BaseIterator &bi)
 Test for greater or equal.

Private Member Functions

 DIterator ()
 The default constructor should never be used.

Private Attributes

BaseIterator i
 The underlying standard iterator.


Detailed Description

template<typename BaseIterator>
class ThePEG::DIterator< BaseIterator >

DIterator is an iterator adaptor class.

It can be used whenever one has a container with pointers to facilitate member selection. The only requirement is that the underlying pointer is pointing to a valid object. Given e.g. a vector of pointers, vector<A*> pv where the class A has a member function dosomething(), it can be used as follows:
typedef DIterator<typename vector<A*>::iterator> It;
for ( It i = dv.begin(), i != dv.end(), ++i ) i->dosomething();

Definition at line 29 of file DIterator.h.


Member Function Documentation

template<typename BaseIterator>
DIterator& ThePEG::DIterator< BaseIterator >::operator++ (  )  [inline]

Pre increment the underlying iterator.

Definition at line 87 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
DIterator ThePEG::DIterator< BaseIterator >::operator++ ( int   )  [inline]

Post increment the underlying iterator.

Definition at line 89 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
DIterator& ThePEG::DIterator< BaseIterator >::operator-- (  )  [inline]

Pre decrement the underlying iterator.

Definition at line 91 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
DIterator ThePEG::DIterator< BaseIterator >::operator-- ( int   )  [inline]

Post decrement the underlying iterator.

Definition at line 93 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
DIterator ThePEG::DIterator< BaseIterator >::operator+ ( int  n  )  [inline]

Get an iterator n steps forward.

Definition at line 97 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::DIterator(), and ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
DIterator ThePEG::DIterator< BaseIterator >::operator- ( int  n  )  [inline]

Get an iterator n steps backward.

Definition at line 101 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::DIterator(), and ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator== ( const DIterator< BaseIterator > &  pi  )  [inline]

Test for equality.

Definition at line 118 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator!= ( const DIterator< BaseIterator > &  pi  )  [inline]

Test for inequality.

Definition at line 120 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator< ( const DIterator< BaseIterator > &  pi  )  [inline]

Test for less.

Definition at line 122 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator> ( const DIterator< BaseIterator > &  pi  )  [inline]

Test for greater.

Definition at line 124 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator<= ( const DIterator< BaseIterator > &  pi  )  [inline]

Test for less or equal.

Definition at line 126 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator>= ( const DIterator< BaseIterator > &  pi  )  [inline]

Test for greater or equal.

Definition at line 128 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator== ( const BaseIterator &  bi  )  [inline]

Test for equality.

Definition at line 130 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator!= ( const BaseIterator &  bi  )  [inline]

Test for inequality.

Definition at line 132 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator< ( const BaseIterator &  bi  )  [inline]

Test for less.

Definition at line 134 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator> ( const BaseIterator &  bi  )  [inline]

Test for greater.

Definition at line 136 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator<= ( const BaseIterator &  bi  )  [inline]

Test for less or equal.

Definition at line 138 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.

template<typename BaseIterator>
bool ThePEG::DIterator< BaseIterator >::operator>= ( const BaseIterator &  bi  )  [inline]

Test for greater or equal.

Definition at line 140 of file DIterator.h.

References ThePEG::DIterator< BaseIterator >::i.


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

Generated on Thu Apr 29 12:43:25 2010 for ThePEG by  doxygen 1.5.5