Simbody  3.7
SimTK::VectorIterator< ELT, VECTOR_CLASS > Class Template Reference

This is an iterator for iterating over the elements of a Vector_ or Vec object. More...

Public Types

typedef ELT value_type
 
typedef ptrdiff_t difference_type
 
typedef ELT & reference
 
typedef ELT * pointer
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

 VectorIterator (VECTOR_CLASS &vector, ptrdiff_t index)
 Create an iterator for the supplied vector and set it to refer to the element at index. More...
 
 VectorIterator ()=delete
 No default constructor. More...
 
 VectorIterator (const VectorIterator &source)=default
 Copy constructor creates a new iterator referring to the same element of the same vector as the source iterator. More...
 
VectorIteratoroperator= (const VectorIterator &source)=default
 Copy assignment makes this iterator refer to the same element of the same vector as the source iterator. More...
 
ELT & operator* ()
 
ELT & operator[] (ptrdiff_t i)
 
VectorIteratoroperator++ ()
 
VectorIterator operator++ (int)
 
VectorIteratoroperator-- ()
 
VectorIterator operator-- (int)
 
VectorIteratoroperator+= (ptrdiff_t n)
 
VectorIteratoroperator-= (ptrdiff_t n)
 
bool operator< (const VectorIterator &iter) const
 
bool operator> (const VectorIterator &iter) const
 
bool operator<= (const VectorIterator &iter) const
 
bool operator>= (const VectorIterator &iter) const
 
ptrdiff_t operator- (const VectorIterator &iter) const
 
VectorIterator operator- (ptrdiff_t n) const
 
VectorIterator operator+ (ptrdiff_t n) const
 
bool operator== (const VectorIterator &iter) const
 
bool operator!= (const VectorIterator &iter) const
 

Detailed Description

template<class ELT, class VECTOR_CLASS>
class SimTK::VectorIterator< ELT, VECTOR_CLASS >

This is an iterator for iterating over the elements of a Vector_ or Vec object.

Template Parameters
ELTThe type of an element stored in the vector whose type is given in VECTOR_CLASS.
VECTOR_CLASSThe type of vector container to iterate through. Its element type must be ELT.

This random access iterator can be used with any container that supports random-access indexing and a size() method. However, the intent is for use internally to allow writing a variety of vector math functions without having to specialize them for the various flavors of vector we support.

Member Typedef Documentation

◆ value_type

template<class ELT , class VECTOR_CLASS >
typedef ELT SimTK::VectorIterator< ELT, VECTOR_CLASS >::value_type

◆ difference_type

template<class ELT , class VECTOR_CLASS >
typedef ptrdiff_t SimTK::VectorIterator< ELT, VECTOR_CLASS >::difference_type

◆ reference

template<class ELT , class VECTOR_CLASS >
typedef ELT& SimTK::VectorIterator< ELT, VECTOR_CLASS >::reference

◆ pointer

template<class ELT , class VECTOR_CLASS >
typedef ELT* SimTK::VectorIterator< ELT, VECTOR_CLASS >::pointer

◆ iterator_category

template<class ELT , class VECTOR_CLASS >
typedef std::random_access_iterator_tag SimTK::VectorIterator< ELT, VECTOR_CLASS >::iterator_category

Constructor & Destructor Documentation

◆ VectorIterator() [1/3]

template<class ELT , class VECTOR_CLASS >
SimTK::VectorIterator< ELT, VECTOR_CLASS >::VectorIterator ( VECTOR_CLASS &  vector,
ptrdiff_t  index 
)
inline

Create an iterator for the supplied vector and set it to refer to the element at index.

◆ VectorIterator() [2/3]

template<class ELT , class VECTOR_CLASS >
SimTK::VectorIterator< ELT, VECTOR_CLASS >::VectorIterator ( )
delete

No default constructor.

◆ VectorIterator() [3/3]

template<class ELT , class VECTOR_CLASS >
SimTK::VectorIterator< ELT, VECTOR_CLASS >::VectorIterator ( const VectorIterator< ELT, VECTOR_CLASS > &  source)
default

Copy constructor creates a new iterator referring to the same element of the same vector as the source iterator.

Member Function Documentation

◆ operator=()

template<class ELT , class VECTOR_CLASS >
VectorIterator& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator= ( const VectorIterator< ELT, VECTOR_CLASS > &  source)
default

Copy assignment makes this iterator refer to the same element of the same vector as the source iterator.

◆ operator*()

template<class ELT , class VECTOR_CLASS >
ELT& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator* ( )
inline

◆ operator[]()

template<class ELT , class VECTOR_CLASS >
ELT& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator[] ( ptrdiff_t  i)
inline

◆ operator++() [1/2]

template<class ELT , class VECTOR_CLASS >
VectorIterator& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator++ ( )
inline

◆ operator++() [2/2]

template<class ELT , class VECTOR_CLASS >
VectorIterator SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator++ ( int  )
inline

◆ operator--() [1/2]

template<class ELT , class VECTOR_CLASS >
VectorIterator& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator-- ( )
inline

◆ operator--() [2/2]

template<class ELT , class VECTOR_CLASS >
VectorIterator SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator-- ( int  )
inline

◆ operator+=()

template<class ELT , class VECTOR_CLASS >
VectorIterator& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator+= ( ptrdiff_t  n)
inline

◆ operator-=()

template<class ELT , class VECTOR_CLASS >
VectorIterator& SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator-= ( ptrdiff_t  n)
inline

◆ operator<()

template<class ELT , class VECTOR_CLASS >
bool SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator< ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

◆ operator>()

template<class ELT , class VECTOR_CLASS >
bool SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator> ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

◆ operator<=()

template<class ELT , class VECTOR_CLASS >
bool SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator<= ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

◆ operator>=()

template<class ELT , class VECTOR_CLASS >
bool SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator>= ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

◆ operator-() [1/2]

template<class ELT , class VECTOR_CLASS >
ptrdiff_t SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator- ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

◆ operator-() [2/2]

template<class ELT , class VECTOR_CLASS >
VectorIterator SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator- ( ptrdiff_t  n) const
inline

◆ operator+()

template<class ELT , class VECTOR_CLASS >
VectorIterator SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator+ ( ptrdiff_t  n) const
inline

◆ operator==()

template<class ELT , class VECTOR_CLASS >
bool SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator== ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

◆ operator!=()

template<class ELT , class VECTOR_CLASS >
bool SimTK::VectorIterator< ELT, VECTOR_CLASS >::operator!= ( const VectorIterator< ELT, VECTOR_CLASS > &  iter) const
inline

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