VectorSTLIterator.h
Classes
- VectorSTLIterator -- AIPS++ Vector iterator (full description)
class VectorSTLIterator: public std::iterator<std::random_access_iterator_tag, T>
Interface
- Public Members
- explicit VectorSTLIterator(const Vector<T> &c) : start_p(c.data()), step_p(std::max(1,c.steps()(0))), iter_p(c.data())
- VectorSTLIterator() : start_p(0), step_p(1), iter_p(0)
- VectorSTLIterator(const typename Array<T>::IteratorSTL &c) : start_p(c.pos()), step_p(std::max(1,c.steps()(0))), iter_p(start_p)
- VectorSTLIterator(const VectorSTLIterator<T>& that) : std::iterator<std::random_access_iterator_tag, T>(that), start_p(that.start_p), step_p(that.step_p), iter_p(that.iter_p)
- VectorSTLIterator<T>& operator=(const VectorSTLIterator<T>& that)
- ~VectorSTLIterator()
- reference operator[](uInt i)
- const_reference operator[](uInt i) const
- reference operator*()
- const_reference operator*() const
- pointer pos() const
- const iterator &operator++()
- iterator operator++(int)
- iterator &operator--()
- iterator operator--(int)
- iterator &operator+=(difference_type i)
- iterator &operator-=(difference_type i)
- iterator operator+(difference_type i) const
- iterator operator-(difference_type i) const
- difference_type operator-(VectorSTLIterator<T> &x) const
- Bool operator== (const iterator &other) const
- 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
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This class creates a random access STL iterator for an aips++ Vector. All
the STL functionality is present (or if something missing can be easily
added).
The following comments hold:
- The Array class begin() and end()<src> functions
create different objects. This class can handle comparisons with the
<src> end()
- 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
Member Description
VectorSTLIterator(const VectorSTLIterator<T>& that) : std::iterator<std::random_access_iterator_tag, T>(that), start_p(that.start_p), step_p(that.step_p), iter_p(that.iter_p)
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.
Copy constructor.
VectorSTLIterator<T>& operator=(const VectorSTLIterator<T>& that)
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.
Assignment.
explicit VectorSTLIterator(const Vector<T> &c) : start_p(c.data()), step_p(std::max(1,c.steps()(0))), iter_p(c.data())
VectorSTLIterator() : start_p(0), step_p(1), iter_p(0)
VectorSTLIterator(const typename Array<T>::IteratorSTL &c) : start_p(c.pos()), step_p(std::max(1,c.steps()(0))), iter_p(start_p)
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.
Destructor
reference operator[](uInt i)
const_reference operator[](uInt i) const
reference operator*()
const_reference operator*() const
pointer pos() const
Access
const iterator &operator++()
iterator operator++(int)
iterator &operator--()
iterator operator--(int)
iterator &operator+=(difference_type i)
iterator &operator-=(difference_type i)
iterator operator+(difference_type i) const
iterator operator-(difference_type i) const
Manipulation
difference_type operator-(VectorSTLIterator<T> &x) const
Size related
Bool operator== (const iterator &other) const
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
Comparisons