test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DeepCopyPointerByClone.h
Go to the documentation of this file.
1 #ifndef DeepCopyPointerByClone_H
2 #define DeepCopyPointerByClone_H
3 
4 #include<algorithm>
5 
10 template <class T>
12 public:
13 
16 
18 
20  if (other.theData) theData = other->clone(); else theData = 0;
21  }
22 
23 
25  if ( theData != other.theData) {
26  delete theData;
27  if (other.theData) theData = other->clone(); else theData = 0;
28  }
29  return *this;
30  }
31 
32  // straight from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2027.html
34  other.theData=0;
35  }
37  std::swap(theData,other.theData);
38  return *this;
39  }
40 
41 
42  T& operator*() { return *theData;}
43  const T& operator*() const { return *theData;}
44 
45  T* operator->() { return theData;}
46  const T* operator->() const { return theData;}
47 
49  operator bool() const { return theData != 0;}
50 
52  bool operator==( const T* otherP) const { return theData == otherP;}
53 
54 private:
56 };
57 
58 #endif // DeepCopyPointerByClone_H
DeepCopyPointerByClone & operator=(DeepCopyPointerByClone &&other)
bool operator==(const T *otherP) const
to allow test like &quot; if (p == &amp;someT) {...}&quot;
DeepCopyPointerByClone & operator=(const DeepCopyPointerByClone &other)
DeepCopyPointerByClone(const DeepCopyPointerByClone &other)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const T & operator*() const
DeepCopyPointerByClone(DeepCopyPointerByClone &&other)
const T * operator->() const
long double T