#ifndef NON_COPYABLE_H
#define NON_COPYABLE_H


/// XXX: Not sure but maybe there is a C++11 std::non_copyable that does the same as this


///
/// Make classes NonCopyable
///
/// Making a class NonCopyable means preventing objects of the class being copied. This is useful if
/// the class manages a resource that can only be held by one object such that it can't be reference
/// counted, or it is the underlying object that becomes reference counted.
///
/// Idea comes from here:  http://stackoverflow.com/questions/9458741/with-explicitly-deleted-member-functions-in-c11-is-it-still-worthwhile-to-inh
///
class NonCopyable
{
public:
	NonCopyable() {}
private:
	NonCopyable(NonCopyable const &);
	NonCopyable& operator=(NonCopyable const &);
};


/*

	Example usage:

	class MyNonCopyableClass : private NonCopyable
	{
		public:
			MyNonCopyableClass() {}
	};

	Now it is not possible to copy objects of this type without a compiler error:

	void function()
	{
		MyNonCopyableClass obj1;
		MyNonCopyableClass obj2;

		// These attempts to make a copy of obj1 will cause a compiler error
		MyNonCopyableClass obj3(obj1);
		obj2 = obj1;
	}

*/


#endif // NON_COPYABLE_H
