summaryrefslogtreecommitdiff
path: root/flower/pcursor.hh
blob: 095bcc45bf697cf0f47362c3c914042c9377c51f (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
  pcursor.hh -- part of flowerlib

  (c) 1996 Han-Wen Nienhuys&Jan Nieuwenhuizen
*/

#ifndef PCURSOR_HH
#define PCURSOR_HH


/// cursor which feels like a pointer
template<class T>
struct PCursor : public Cursor<T> {

    /// make cursor with #no# items back
    PCursor<T> operator -( int no) const {
	return PCursor<T> (Cursor<T>::operator-(no));
    }

    /// make cursor with #no# items further
    PCursor<T> operator +( int no) const {
	return PCursor<T> (Cursor<T>::operator+(no));
    }
    PCursor(const List<T> & l) : Cursor<T> (l) {}

    PCursor( const Cursor<T>& cursor ) : Cursor<T>(cursor) { }
    T operator ->() const { return  *(*(Cursor<T> *)this); }

};
/**
 I like  operator->(), so here it is.

 Cursor to go with pointer list.
 */
#endif