CMS 3D CMS Logo

OwnIt.h
Go to the documentation of this file.
1 #ifndef OwnIt_H
2 #define OwnIt_H
3 
7 template<class T>
8 class OwnIt {
9 public:
10  typedef OwnIt<T> self;
11  OwnIt(T * p=0) : it(p){}
12 
13  ~OwnIt() { reset();}
14  inline self& operator=(T * p) { if (it) delete it; it=p; return * this;}
15  inline T * get() const { return it;}
16  inline void reset() { if (it) { delete it; it=0; } }
17 
18 private:
19  T * it;
20 
21 };
22 
23 #endif // OwnIt_H
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
OwnIt
Definition: OwnIt.h:8
OwnIt::~OwnIt
~OwnIt()
Definition: OwnIt.h:13
OwnIt::reset
void reset()
Definition: OwnIt.h:16
OwnIt::get
T * get() const
Definition: OwnIt.h:15
OwnIt::operator=
self & operator=(T *p)
Definition: OwnIt.h:14
OwnIt::it
T * it
Definition: OwnIt.h:19
OwnIt::OwnIt
OwnIt(T *p=0)
Definition: OwnIt.h:11
T
long double T
Definition: Basic3DVectorLD.h:48