CMS 3D CMS Logo

IterWithDict.h
Go to the documentation of this file.
1 #ifndef FWCore_Reflection_IterWithDict_h
2 #define FWCore_Reflection_IterWithDict_h
3 
4 /*----------------------------------------------------------------------
5 
6 IterWithDict: An iterator for a TList so a range for loop can be used
7 
8 ----------------------------------------------------------------------*/
9 
10 #include "TList.h"
11 
12 namespace edm {
13 
15  private:
16  TIter iter_;
17  bool atEnd_;
18 
19  protected:
20  void advance();
21  TIter const& iter() const;
22 
23  public:
25  explicit IterWithDictBase(TList*);
26  bool operator!=(IterWithDictBase const&) const;
27  };
28 
29  template <typename T>
30  class IterWithDict : public IterWithDictBase {
31  public:
33  explicit IterWithDict(TList* list) : IterWithDictBase(list) {}
35  advance();
36  return *this;
37  }
38  T* operator*() const { return static_cast<T*>(*iter()); }
39  };
40 
41 } // namespace edm
42 
43 #endif // FWCore_Reflection_IterWithDict_h
TIter const & iter() const
Definition: IterWithDict.cc:16
T * operator*() const
Definition: IterWithDict.h:38
bool operator!=(IterWithDictBase const &) const
Definition: IterWithDict.cc:33
HLT enums.
IterWithDict(TList *list)
Definition: IterWithDict.h:33
IterWithDict< T > & operator++()
Definition: IterWithDict.h:34
long double T