// -*- c++ -*- #pragma once #ifndef __XOT_PIMPL_H__ #define __XOT_PIMPL_H__ #include #include namespace Xot { template class PImpl; template class PImpl : public boost::scoped_ptr { typedef boost::scoped_ptr Super; typedef PImpl 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 class PImpl : public boost::shared_ptr { typedef boost::shared_ptr Super; typedef PImpl This; public: PImpl () : Super(new T) {} PImpl (T* p) : Super(p) {} bool shared () const {return true;} };// PImpl }// Xot #endif//EOH