source: CMT/v1r19/source/cmt_vector_iterator.h @ 1

Last change on this file since 1 was 1, checked in by arnault, 19 years ago

Import all tags

File size: 1.6 KB
Line 
1//-----------------------------------------------------------
2// Copyright Christian Arnault LAL-Orsay CNRS
3// arnault@lal.in2p3.fr
4// See the complete license in cmt_license.txt "http://www.cecill.info".
5//-----------------------------------------------------------
6
7class iterator
8{
9  public:
10  iterator ()
11      {
12        _index = 0;
13        _vector = 0;
14      }
15
16  iterator (cmt_vector& vector)
17      {
18        _index = 0;
19        _vector = &vector;
20      }
21
22  iterator (const iterator& other)
23      {
24        _index = other._index;
25        _vector = other._vector;
26      }
27
28  iterator& operator = (const iterator& other)
29      {
30        _index = other._index;
31        _vector = other._vector;
32
33        return (*this);
34      }
35
36  bool operator == (const iterator& other)
37      {
38        if (_vector != other._vector) return (false);
39        if (_index != other._index) return (false);
40
41        return (true);
42      }
43
44  iterator& operator ++ ()
45      {
46        if (_vector != 0)
47          {
48            _index++;
49          }
50
51        return (*this);
52      };
53
54  iterator& operator -- ()
55      {
56        return (*this);
57      };
58
59  int operator - (const iterator* other)
60      {
61        return (0);
62      };
63
64  iterator operator + (int offset)
65      {
66        iterator it = *this;
67        return (it);
68      };
69
70  iterator operator - (int offset)
71      {
72        iterator it = *this;
73        return (it);
74      };
75
76  T& operator * ()
77      {
78        return ();
79      };
80
81  private:
82  int _index;
83  cmt_vector* _vector;
84};
Note: See TracBrowser for help on using the repository browser.