Rev | Line | |
---|
[1] | 1 | class iterator |
---|
| 2 | { |
---|
| 3 | public: |
---|
| 4 | iterator () |
---|
| 5 | { |
---|
| 6 | _index = 0; |
---|
| 7 | _vector = 0; |
---|
| 8 | } |
---|
| 9 | |
---|
| 10 | iterator (cmt_vector& vector) |
---|
| 11 | { |
---|
| 12 | _index = 0; |
---|
| 13 | _vector = &vector; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | iterator (const iterator& other) |
---|
| 17 | { |
---|
| 18 | _index = other._index; |
---|
| 19 | _vector = other._vector; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | iterator& operator = (const iterator& other) |
---|
| 23 | { |
---|
| 24 | _index = other._index; |
---|
| 25 | _vector = other._vector; |
---|
| 26 | |
---|
| 27 | return (*this); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | bool operator == (const iterator& other) |
---|
| 31 | { |
---|
| 32 | if (_vector != other._vector) return (false); |
---|
| 33 | if (_index != other._index) return (false); |
---|
| 34 | |
---|
| 35 | return (true); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | iterator& operator ++ () |
---|
| 39 | { |
---|
| 40 | if (_vector != 0) |
---|
| 41 | { |
---|
| 42 | _index++; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | return (*this); |
---|
| 46 | }; |
---|
| 47 | |
---|
| 48 | iterator& operator -- () |
---|
| 49 | { |
---|
| 50 | return (*this); |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | int operator - (const iterator* other) |
---|
| 54 | { |
---|
| 55 | return (0); |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | iterator operator + (int offset) |
---|
| 59 | { |
---|
| 60 | iterator it = *this; |
---|
| 61 | return (it); |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | iterator operator - (int offset) |
---|
| 65 | { |
---|
| 66 | iterator it = *this; |
---|
| 67 | return (it); |
---|
| 68 | }; |
---|
| 69 | |
---|
| 70 | T& operator * () |
---|
| 71 | { |
---|
| 72 | return (); |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | private: |
---|
| 76 | int _index; |
---|
| 77 | cmt_vector* _vector; |
---|
| 78 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.