"Fossies" - the Fresh Open Source Software Archive 
Member "portfwd-0.29/src/iterator.hpp" (15 May 2001, 820 Bytes) of package /linux/privat/old/portfwd-0.29.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 iterator.hpp
3
4 $Id: iterator.hpp,v 1.1.1.1 2001/05/15 00:25:00 evertonm Exp $
5 */
6
7
8 #ifndef ITERATOR_HPP
9 #define ITERATOR_HPP
10
11
12 template <class C, class T>
13 class iterator
14 {
15 private:
16
17 C *vect;
18 T *current;
19
20 public:
21
22 iterator(const C& vec);
23
24 void start();
25 int cont();
26 void next();
27
28 T& get();
29 };
30
31 template <class C, class T>
32 iterator<C, T>::iterator(const C& vec)
33 {
34 vect = (C*) &vec;
35 }
36
37 template <class C, class T>
38 void iterator<C, T>::start()
39 {
40 current = vect->begin_ptr();
41 }
42
43 template <class C, class T>
44 int iterator<C, T>::cont()
45 {
46 return current != vect->past_end_ptr();
47 }
48
49 template <class C, class T>
50 void iterator<C, T>::next()
51 {
52 current = C::next_ptr(current);
53 }
54
55 template <class C, class T>
56 T& iterator<C, T>::get()
57 {
58 return *current;
59 }
60
61
62 #endif // ITERATOR_HPP
63
64
65 // Eof: iterator.hpp