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
edm::IterWithDict::operator*
T * operator*() const
Definition: IterWithDict.h:38
edm::IterWithDictBase::iter
TIter const & iter() const
Definition: IterWithDict.cc:16
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::IterWithDict::IterWithDict
IterWithDict(TList *list)
Definition: IterWithDict.h:33
edm::IterWithDictBase::atEnd_
bool atEnd_
Definition: IterWithDict.h:17
edm::IterWithDict::operator++
IterWithDict< T > & operator++()
Definition: IterWithDict.h:34
edm::IterWithDict
Definition: IterWithDict.h:30
edm::IterWithDictBase
Definition: IterWithDict.h:14
edm::IterWithDictBase::operator!=
bool operator!=(IterWithDictBase const &) const
Definition: IterWithDict.cc:33
edm::IterWithDictBase::advance
void advance()
Definition: IterWithDict.cc:6
edm::IterWithDict::IterWithDict
IterWithDict()
Definition: IterWithDict.h:32
T
long double T
Definition: Basic3DVectorLD.h:48
edm::IterWithDictBase::iter_
TIter iter_
Definition: IterWithDict.h:16
edm::IterWithDictBase::IterWithDictBase
IterWithDictBase()
Definition: IterWithDict.cc:18