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
~OwnIt()
Definition: OwnIt.h:13
void reset()
Definition: OwnIt.h:16
T * it
Definition: OwnIt.h:19
OwnIt(T *p=0)
Definition: OwnIt.h:11
self & operator=(T *p)
Definition: OwnIt.h:14
Definition: OwnIt.h:8
long double T