// -*- c++ -*- #pragma once #ifndef __XOT_PIMPL_H__ #define __XOT_PIMPL_H__ #include namespace Xot { template class PImpl : public std::unique_ptr { typedef std::unique_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; } };// PImpl template class PSharedImpl : public std::shared_ptr { typedef std::shared_ptr Super; typedef PImpl This; public: PSharedImpl () : Super(new T) {} PSharedImpl (T* p) : Super(p) {} };// PSharedImpl }// Xot #endif//EOH