casacore
Loading...
Searching...
No Matches
casacore::VectorSTLIterator< T > Class Template Reference

More...

#include <VectorSTLIterator.h>

Public Types

using iterator_category
 iterator traits
typedef T value_type
typedef value_typepointer
typedef const value_typeconst_pointer
typedef VectorSTLIterator< T > iterator
typedef const VectorSTLIterator< T > const_iterator
typedef value_typereference
typedef const value_typeconst_reference
typedef std::size_t size_type
typedef ptrdiff_t difference_type

Public Member Functions

 VectorSTLIterator (const Vector< T > &c)
 Constructors.
 VectorSTLIterator ()
 VectorSTLIterator (const typename Array< T >::IteratorSTL &c)
reference operator[] (size_t i)
 Access.
const_reference operator[] (size_t i) const
reference operator* ()
const_reference operator* () const
pointer pos () const
const iteratoroperator++ ()
 Manipulation.
iterator operator++ (int)
iteratoroperator-- ()
iterator operator-- (int)
iteratoroperator+= (difference_type i)
iteratoroperator-= (difference_type i)
iterator operator+ (difference_type i) const
iterator operator- (difference_type i) const
difference_type operator- (const VectorSTLIterator< T > &x) const
 Size related.
bool operator== (const iterator &other) const
 Comparisons.
bool operator!= (const iterator other) const
bool operator< (const iterator &other) const
bool operator== (const_pointer const pos) const
bool operator!= (const_pointer const pos) const
bool operator< (const_pointer const pos) const

Protected Attributes

pointer const start_p
 Start (for random indexing).
difference_type step_p
 Distance between elements.
pointer iter_p
 Current element pointer.

Detailed Description

template<typename T>
class casacore::VectorSTLIterator< T >

Casacore Vector iterator

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

This class creates a random access STL iterator for an Casacore Vector. All the STL functionality is present (or if something missing can be easily added).
The following comments hold:

  • A VectorSTLIterator can be created from a Vector (non-STL) It is the same as using Vector.begin()
  • No contiguous iterator is provided. Its construction is not necessary, since Vector.data() is a fully functional STL iterator already.
  • This iterator is non-intrusive. Since it needs state (the 'step') nothing substantial is gained by having it included in the Vector class. The major gain would be to be able to use the standard nomenclature: Vector::iterator() rather than VectorSTLiterator
  • It would be advisable, and easy to implement, to add a template argument to the Array classes: <class T, bool isCont=true>. The default is contiguous, since creation is contiguous. In that case correct iterators for e.g. contiguous arrays are supplied automatically.
  • needs probably some 'const' fine tuning; and the -> operator

Definition at line 64 of file VectorSTLIterator.h.

Member Typedef Documentation

◆ const_iterator

template<typename T>
typedef const VectorSTLIterator<T> casacore::VectorSTLIterator< T >::const_iterator

Definition at line 73 of file VectorSTLIterator.h.

◆ const_pointer

template<typename T>
typedef const value_type* casacore::VectorSTLIterator< T >::const_pointer

Definition at line 71 of file VectorSTLIterator.h.

◆ const_reference

template<typename T>
typedef const value_type& casacore::VectorSTLIterator< T >::const_reference

Definition at line 75 of file VectorSTLIterator.h.

◆ difference_type

template<typename T>
typedef ptrdiff_t casacore::VectorSTLIterator< T >::difference_type

Definition at line 77 of file VectorSTLIterator.h.

◆ iterator

template<typename T>
typedef VectorSTLIterator<T> casacore::VectorSTLIterator< T >::iterator

Definition at line 72 of file VectorSTLIterator.h.

◆ iterator_category

template<typename T>
using casacore::VectorSTLIterator< T >::iterator_category

iterator traits

Definition at line 67 of file VectorSTLIterator.h.

◆ pointer

template<typename T>
typedef value_type* casacore::VectorSTLIterator< T >::pointer

Definition at line 70 of file VectorSTLIterator.h.

◆ reference

template<typename T>
typedef value_type& casacore::VectorSTLIterator< T >::reference

Definition at line 74 of file VectorSTLIterator.h.

◆ size_type

template<typename T>
typedef std::size_t casacore::VectorSTLIterator< T >::size_type

Definition at line 76 of file VectorSTLIterator.h.

◆ value_type

template<typename T>
typedef T casacore::VectorSTLIterator< T >::value_type

Definition at line 69 of file VectorSTLIterator.h.

Constructor & Destructor Documentation

◆ VectorSTLIterator() [1/3]

template<typename T>
casacore::VectorSTLIterator< T >::VectorSTLIterator ( const Vector< T > & c)
inlineexplicit

Constructors.

The iterator constructor from a Vector is the same as if created from Vector.begin(). Copy constructor and assignment can be the default ones.

Definition at line 84 of file VectorSTLIterator.h.

References iter_p, casacore::max(), start_p, and step_p.

Referenced by operator+(), operator-(), operator-(), and operator--().

◆ VectorSTLIterator() [2/3]

template<typename T>
casacore::VectorSTLIterator< T >::VectorSTLIterator ( )
inline

Definition at line 89 of file VectorSTLIterator.h.

References iter_p, start_p, and step_p.

◆ VectorSTLIterator() [3/3]

template<typename T>
casacore::VectorSTLIterator< T >::VectorSTLIterator ( const typename Array< T >::IteratorSTL & c)
inline

Definition at line 91 of file VectorSTLIterator.h.

References iter_p, casacore::max(), pos(), start_p, and step_p.

Member Function Documentation

◆ operator!=() [1/2]

template<typename T>
bool casacore::VectorSTLIterator< T >::operator!= ( const iterator other) const
inline

Definition at line 132 of file VectorSTLIterator.h.

References iter_p.

◆ operator!=() [2/2]

template<typename T>
bool casacore::VectorSTLIterator< T >::operator!= ( const_pointer const pos) const
inline

Definition at line 138 of file VectorSTLIterator.h.

References iter_p, and pos().

◆ operator*() [1/2]

template<typename T>
reference casacore::VectorSTLIterator< T >::operator* ( )
inline

Definition at line 102 of file VectorSTLIterator.h.

References iter_p.

◆ operator*() [2/2]

template<typename T>
const_reference casacore::VectorSTLIterator< T >::operator* ( ) const
inline

Definition at line 103 of file VectorSTLIterator.h.

References iter_p.

◆ operator+()

template<typename T>
iterator casacore::VectorSTLIterator< T >::operator+ ( difference_type i) const
inline

Definition at line 118 of file VectorSTLIterator.h.

References VectorSTLIterator().

◆ operator++() [1/2]

template<typename T>
const iterator & casacore::VectorSTLIterator< T >::operator++ ( )
inline

Manipulation.

Definition at line 108 of file VectorSTLIterator.h.

References iter_p, and step_p.

◆ operator++() [2/2]

template<typename T>
iterator casacore::VectorSTLIterator< T >::operator++ ( int )
inline

Definition at line 109 of file VectorSTLIterator.h.

References iter_p, and step_p.

◆ operator+=()

template<typename T>
iterator & casacore::VectorSTLIterator< T >::operator+= ( difference_type i)
inline

Definition at line 114 of file VectorSTLIterator.h.

References iter_p, and step_p.

◆ operator-() [1/2]

template<typename T>
difference_type casacore::VectorSTLIterator< T >::operator- ( const VectorSTLIterator< T > & x) const
inline

Size related.

Definition at line 125 of file VectorSTLIterator.h.

References iter_p, step_p, and VectorSTLIterator().

◆ operator-() [2/2]

template<typename T>
iterator casacore::VectorSTLIterator< T >::operator- ( difference_type i) const
inline

Definition at line 120 of file VectorSTLIterator.h.

References VectorSTLIterator().

◆ operator--() [1/2]

template<typename T>
iterator & casacore::VectorSTLIterator< T >::operator-- ( )
inline

Definition at line 111 of file VectorSTLIterator.h.

References iter_p, and step_p.

◆ operator--() [2/2]

template<typename T>
iterator casacore::VectorSTLIterator< T >::operator-- ( int )
inline

Definition at line 112 of file VectorSTLIterator.h.

References iter_p, step_p, and VectorSTLIterator().

◆ operator-=()

template<typename T>
iterator & casacore::VectorSTLIterator< T >::operator-= ( difference_type i)
inline

Definition at line 116 of file VectorSTLIterator.h.

References iter_p, and step_p.

◆ operator<() [1/2]

template<typename T>
bool casacore::VectorSTLIterator< T >::operator< ( const iterator & other) const
inline

Definition at line 134 of file VectorSTLIterator.h.

References iter_p.

◆ operator<() [2/2]

template<typename T>
bool casacore::VectorSTLIterator< T >::operator< ( const_pointer const pos) const
inline

Definition at line 140 of file VectorSTLIterator.h.

References iter_p, and pos().

◆ operator==() [1/2]

template<typename T>
bool casacore::VectorSTLIterator< T >::operator== ( const iterator & other) const
inline

Comparisons.

Definition at line 130 of file VectorSTLIterator.h.

References iter_p.

◆ operator==() [2/2]

template<typename T>
bool casacore::VectorSTLIterator< T >::operator== ( const_pointer const pos) const
inline

Definition at line 136 of file VectorSTLIterator.h.

References iter_p, and pos().

◆ operator[]() [1/2]

template<typename T>
reference casacore::VectorSTLIterator< T >::operator[] ( size_t i)
inline

Access.

Definition at line 99 of file VectorSTLIterator.h.

References start_p, and step_p.

◆ operator[]() [2/2]

template<typename T>
const_reference casacore::VectorSTLIterator< T >::operator[] ( size_t i) const
inline

Definition at line 100 of file VectorSTLIterator.h.

References start_p, and step_p.

◆ pos()

template<typename T>
pointer casacore::VectorSTLIterator< T >::pos ( ) const
inline

Definition at line 104 of file VectorSTLIterator.h.

References iter_p.

Referenced by operator!=(), operator<(), operator==(), and VectorSTLIterator().

Member Data Documentation

◆ iter_p

◆ start_p

template<typename T>
pointer const casacore::VectorSTLIterator< T >::start_p
protected

Start (for random indexing).

Definition at line 145 of file VectorSTLIterator.h.

Referenced by operator[](), operator[](), VectorSTLIterator(), VectorSTLIterator(), and VectorSTLIterator().

◆ step_p


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