OpenADFortTk (including Open64 and OpenAnalysis references)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SetIterator.hpp
Go to the documentation of this file.
1 
16 #ifndef SetIterator_H
17 #define SetIterator_H
18 
19 // STL headers
20 #include <set>
21 
23 
24 namespace OA {
25 
26 template <class T>
27 class SetIterator {
28 public:
29  SetIterator (OA_ptr<std::set<T> > pSet) : mSet(pSet), mIter(pSet->begin())
30  {}
31  virtual ~SetIterator () {}
32 
33  void operator++() { if (mIter != mSet->end()) { mIter++; } }
34  void operator++(int) { ++*this; }
35 
37  bool isValid() { return (mIter != mSet->end()); }
38 
40  T current() { return *mIter; }
41 
42  void reset() { mIter = mSet->begin(); }
43 
44  private:
46  typename std::set<T>::iterator mIter;
47 };
48 
49 } // end of OA namespace
50 
51 #endif