Sha256: 1764b36796bce57f07396b8fc303eddfd0f4b307240945db6c11c37007d237c4

Contents?: true

Size: 759 Bytes

Versions: 8

Compression:

Stored size: 759 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(new T(*obj)) {}

			This& operator = (const This& obj)
			{
				if (&obj != this) reset(new T(*obj));
				return *this;
			}

	};// PImpl


	template <typename T>
	class PSharedImpl : public std::shared_ptr<T>
	{

		typedef std::shared_ptr<T> Super;

		typedef PImpl<T> This;

		public:

			PSharedImpl () : Super(new T) {}

			PSharedImpl (T* p) : Super(p) {}

	};// PSharedImpl


}// Xot


#endif//EOH

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xot-0.1.22 include/xot/pimpl.h
xot-0.1.21 include/xot/pimpl.h
xot-0.1.20 include/xot/pimpl.h
xot-0.1.19 include/xot/pimpl.h
xot-0.1.16 include/xot/pimpl.h
xot-0.1.15 include/xot/pimpl.h
xot-0.1.14 include/xot/pimpl.h
xot-0.1.13 include/xot/pimpl.h