Sha256: ea21b0e75f289fd0ca4e8a0a540abf994e5e7f443a9e7454a406b7a672a7622f
Contents?: true
Size: 826 Bytes
Versions: 13
Compression:
Stored size: 826 Bytes
Contents
// -*- c++ -*- #pragma once #ifndef __XOT_PIMPL_H__ #define __XOT_PIMPL_H__ #include <memory> namespace Xot { template <typename T> class PImpl : public std::unique_ptr<T> { typedef std::unique_ptr<T> Super; typedef PImpl<T> This; public: PImpl () : Super(new T) {} PImpl (T* p) : Super(p) {} PImpl (const This& obj) : Super(obj ? new T(*obj) : NULL) { } This& operator = (const This& obj) { if (&obj == this) return *this; this->reset(obj ? new T(*obj) : NULL); return *this; } };// PImpl template <typename T> class PSharedImpl : public std::shared_ptr<T> { typedef std::shared_ptr<T> Super; typedef PSharedImpl<T> This; public: PSharedImpl () : Super(new T) {} PSharedImpl (T* p) : Super(p) {} };// PSharedImpl }// Xot #endif//EOH
Version data entries
13 entries across 13 versions & 1 rubygems