Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JForwardIterator.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JFORWARDITERATOR__
2 #define __JLANG__JFORWARDITERATOR__
3 
4 /**
5  * \author mdejong
6  */
7 
8 namespace JLANG {}
9 namespace JPP { using namespace JLANG; }
10 
11 namespace JLANG {
12 
13  /**
14  * Template interface for method bool increment().
15  * This interface implements the pre-fix and post-fix operators <tt>++</tt>.
16  */
17  template<class T>
19  public:
20  /**
21  * Virtual destructor.
22  */
24  {}
25 
26 
27  /**
28  * Increment iterator.
29  *
30  * \return this iterator
31  */
33  {
34  this->increment();
35 
36  return static_cast<T&>(*this);
37  }
38 
39 
40  /**
41  * Increment iterator.
42  *
43  * \return previous iterator
44  */
45  T operator++(int)
46  {
47  const T tmp(static_cast<const T&>(*this));
48 
49  this->increment();
50 
51  return tmp;
52  }
53 
54 
55  /**
56  * Increment iterator.
57  *
58  * \return true if incremented; else false
59  */
60  virtual bool increment() = 0;
61  };
62 }
63 
64 #endif
65 
virtual ~JForwardIterator()
Virtual destructor.
Template interface for method bool increment().
T operator++(int)
Increment iterator.
virtual bool increment()=0
Increment iterator.
T & operator++()
Increment iterator.