In reading TCPL, I got a problem, as the title refered, and then \'private\' class is:
class Unique_handle {
private:
Unique_handle& operato
You can use a shared_ptr to share the object:
class Y
{
public:
Y(): mHandle(new UniqueHandle()) {}
private:
boost::shared_ptr mHandle;
};
It's as simple as that.
If you don't want shared ownership, you can use boost::scoped_ptr or the newly created std::unique_ptr if you have access to it, and then implement the CopyConstructor and AssignmentOperator yourself, taking care of their semantics.