1 #ifndef SimTK_SIMMATRIX_VECTORITERATOR_H_ 2 #define SimTK_SIMMATRIX_VECTORITERATOR_H_ 51 template <
class ELT,
class VECTOR_CLASS>
52 class VectorIterator {
63 : vectorp(&vector), index(index) {}
69 assert (index >= 0 && index < vectorp->size());
70 return (*vectorp)[(int)index];
73 assert (i >= 0 && i < vectorp->size());
74 return (*vectorp)[(int)i];
77 assert (index < vectorp->size());
82 assert (index < vectorp->size());
99 assert (0 <= index+n && index+n <= vectorp->size());
104 assert (0 <= index-n && index-n <= vectorp->size());
109 return (index < iter.index);
112 return (index > iter.index);
115 return (index <= iter.index);
118 return (index >= iter.index);
121 return (index - iter.index);
130 return (index == iter.index);
133 return (index != iter.index);
136 VECTOR_CLASS* vectorp;
142 #endif // SimTK_SIMMATRIX_VECTORITERATOR_H_ ptrdiff_t operator-(const VectorIterator &iter) const
Definition: VectorIterator.h:120
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
std::random_access_iterator_tag iterator_category
Definition: VectorIterator.h:58
VectorIterator operator-(ptrdiff_t n) const
Definition: VectorIterator.h:123
bool operator>=(const VectorIterator &iter) const
Definition: VectorIterator.h:117
VectorIterator(VECTOR_CLASS &vector, ptrdiff_t index)
Create an iterator for the supplied `vector` and set it to refer to the element at `index`...
Definition: VectorIterator.h:62
VectorIterator & operator+=(ptrdiff_t n)
Definition: VectorIterator.h:98
bool operator>(const VectorIterator &iter) const
Definition: VectorIterator.h:111
VectorIterator operator+(ptrdiff_t n) const
Definition: VectorIterator.h:126
This is an iterator for iterating over the elements of a Vector_ or Vec object.
Definition: BigMatrix.h:176
VectorIterator operator++(int)
Definition: VectorIterator.h:81
VectorIterator operator--(int)
Definition: VectorIterator.h:92
bool operator<=(const VectorIterator &iter) const
Definition: VectorIterator.h:114
bool operator!=(const VectorIterator &iter) const
Definition: VectorIterator.h:132
ELT & operator[](ptrdiff_t i)
Definition: VectorIterator.h:72
bool operator==(const VectorIterator &iter) const
Definition: VectorIterator.h:129
VectorIterator & operator--()
Definition: VectorIterator.h:87
ELT & operator*()
Definition: VectorIterator.h:68
VectorIterator & operator-=(ptrdiff_t n)
Definition: VectorIterator.h:103
bool operator<(const VectorIterator &iter) const
Definition: VectorIterator.h:108
ELT value_type
Definition: VectorIterator.h:54
VectorIterator & operator++()
Definition: VectorIterator.h:76
ptrdiff_t difference_type
Definition: VectorIterator.h:55
ELT & reference
Definition: VectorIterator.h:56
ELT * pointer
Definition: VectorIterator.h:57