RobWorkProject
Public Types | Public Member Functions | Friends | List of all members
ConcatVectorIterator< T > Class Template Reference

Forward iterator for the concatenation of a pair of vectors of pointers to T. More...

#include <ConcatVectorIterator.hpp>

Public Types

typedef std::forward_iterator_tag iterator_category
 
typedef T value_type
 
typedef T * pointer
 
typedef T & reference
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 ConcatVectorIterator (const PtrTVector *curr, I pos, const PtrTVector *next)
 Constructor. More...
 
T & operator* () const
 Reference to the T element.
 
T * operator-> () const
 Pointer to the T element.
 
ConcatVectorIteratoroperator++ ()
 Increments the position of the iterator. More...
 
ConcatVectorIterator operator++ (int)
 Increments the position of the iterator. More...
 
bool operator== (const ConcatVectorIterator &other) const
 Tests whether the positions of two iterators are equal. More...
 
bool operator!= (const ConcatVectorIterator &other) const
 Tests whether the positions of two iterators are unequal. More...
 

Friends

class ConstConcatVectorIterator< T >
 

Detailed Description

template<typename T>
class rw::common::ConcatVectorIterator< T >

Forward iterator for the concatenation of a pair of vectors of pointers to T.

Member Typedef Documentation

◆ difference_type

typedef ptrdiff_t difference_type

Difference type.

◆ iterator_category

typedef std::forward_iterator_tag iterator_category

Iterator category.

◆ pointer

typedef T* pointer

Pointer type.

◆ reference

typedef T& reference

Reference type.

◆ value_type

typedef T value_type

Value type.

Constructor & Destructor Documentation

◆ ConcatVectorIterator()

ConcatVectorIterator ( const PtrTVector *  curr,
pos,
const PtrTVector *  next 
)
inline

Constructor.

The iterator pos points into curr. When the iterator reaches the end of curr it then switches to the start of next.

Given a pair of vectors curr and next, the start and end iterator for the concatenated sequence are given by

const ConcatVectorIterator<T> begin(curr, curr->begin(), next);
const ConcatVectorIterator<T> end(next, next->end(), 0);
       You can use ConcatVectorIterator for iterating through a single
       sequence by letting \b next be NULL.

Member Function Documentation

◆ operator!=()

bool operator!= ( const ConcatVectorIterator< T > &  other) const
inline

Tests whether the positions of two iterators are unequal.

Parameters
other[in] ConcatVectorIterator to compare with
Returns
true if unequal

◆ operator++() [1/2]

ConcatVectorIterator& operator++ ( )
inline

Increments the position of the iterator.

Returns
Reference to the incremented iterator

◆ operator++() [2/2]

ConcatVectorIterator operator++ ( int  )
inline

Increments the position of the iterator.

Returns
the ConcatVectorIterator with the value before the incrementation

◆ operator==()

bool operator== ( const ConcatVectorIterator< T > &  other) const
inline

Tests whether the positions of two iterators are equal.

Parameters
other[in] ConcatVectorIterator to compare with
Returns
true if equal

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