Sha256: 28ed0c37a12ad84c01642e9e0fc4ccd940fc6e6c2a3f3b1f05def2d24ba8e6fa
Contents?: true
Size: 961 Bytes
Versions: 9
Compression:
Stored size: 961 Bytes
Contents
// -*- c++ -*- #pragma once #ifndef __XOT_PIMPL_H__ #define __XOT_PIMPL_H__ #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> namespace Xot { template <typename T, bool SHARED = false> class PImpl; template <typename T> class PImpl<T, false> : public boost::scoped_ptr<T> { typedef boost::scoped_ptr<T> Super; typedef PImpl<T, false> This; public: PImpl () : Super(new T) {} PImpl (T* p) : Super(p) {} PImpl (const This& obj) : Super(new T(*obj)) {} This& operator = (const This& obj) { if (&obj != this) reset(new T(*obj)); return *this; } bool shared () const {return false;} };// PImpl template <typename T> class PImpl<T, true> : public boost::shared_ptr<T> { typedef boost::shared_ptr<T> Super; typedef PImpl<T, true> This; public: PImpl () : Super(new T) {} PImpl (T* p) : Super(p) {} bool shared () const {return true;} };// PImpl }// Xot #endif//EOH
Version data entries
9 entries across 9 versions & 1 rubygems