1 #ifndef SimTK_SIMMATRIX_VECTORITERATOR_H_
2 #define SimTK_SIMMATRIX_VECTORITERATOR_H_
51 template <
class ELT,
class VECTOR_CLASS>
52 class VectorIterator {
60 : vector(vector), index(index) {}
62 : vector(iter.vector), index(iter.index) {}
69 assert (index >= 0 && index < vector.size());
70 return vector[(int)index];
73 assert (i >= 0 && i < vector.size());
74 return vector[(int)i];
77 assert (index < vector.size());
82 assert (index < vector.size());
99 assert (0 <= index+n && index+n <= vector.size());
104 assert (0 <= index-n && index-n <= vector.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& vector;
142 #endif // SimTK_SIMMATRIX_VECTORITERATOR_H_
VectorIterator operator--()
Definition: VectorIterator.h:87
ELT & reference
Definition: VectorIterator.h:56
VectorIterator(const VectorIterator &iter)
Definition: VectorIterator.h:61
bool operator>(VectorIterator iter) const
Definition: VectorIterator.h:111
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
bool operator>=(VectorIterator iter) const
Definition: VectorIterator.h:117
VectorIterator operator+(ptrdiff_t n) const
Definition: VectorIterator.h:126
bool operator<=(VectorIterator iter) const
Definition: VectorIterator.h:114
std::random_access_iterator_tag iterator_category
Definition: VectorIterator.h:58
VectorIterator & operator=(const VectorIterator &iter)
Definition: VectorIterator.h:63
VectorIterator operator+=(ptrdiff_t n)
Definition: VectorIterator.h:98
ELT value_type
Definition: VectorIterator.h:54
bool operator!=(VectorIterator iter) const
Definition: VectorIterator.h:132
bool operator==(VectorIterator iter) const
Definition: VectorIterator.h:129
ELT * pointer
Definition: VectorIterator.h:57
ELT & operator*()
Definition: VectorIterator.h:68
ptrdiff_t difference_type
Definition: VectorIterator.h:55
VectorIterator operator-(ptrdiff_t n) const
Definition: VectorIterator.h:123
ptrdiff_t operator-(VectorIterator iter) const
Definition: VectorIterator.h:120
bool operator<(VectorIterator iter) const
Definition: VectorIterator.h:108
VectorIterator(VECTOR_CLASS &vector, ptrdiff_t index)
Definition: VectorIterator.h:59
VectorIterator operator++(int)
Definition: VectorIterator.h:81
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:92
ELT & operator[](ptrdiff_t i)
Definition: VectorIterator.h:72
VectorIterator operator-=(ptrdiff_t n)
Definition: VectorIterator.h:103
VectorIterator operator++()
Definition: VectorIterator.h:76