ArrDelAdapter.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef ARR_DEL_ADAPTER
00009 #define ARR_DEL_ADAPTER
00010 
00011 /// A auto_ptr implementation to handle
00012 ///  array memory management.
00013 
00014 template <typename T>
00015 class ArrDelAdapter {
00016 public:
00017   ArrDelAdapter(T *p) : p_(p) { }
00018   ArrDelAdapter(const ArrDelAdapter<T>& var)
00019   : p_(var.p_) {
00020     // copier gets sole handle to ptr
00021     const_cast<ArrDelAdapter<T>&>(var).p_ = 0;
00022   }
00023   ~ArrDelAdapter() {
00024     delete [] p_;
00025   }
00026   // operators like ->, *, etc...
00027 private:
00028   T* p_;
00029 };
00030 
00031 #endif /* ARR_DEL_ADAPTER */

Generated on Fri Feb 12 20:05:18 2016 for OpenDDS by  doxygen 1.4.7