no, something like that is just about impossible in C++.

The way I read it, it works like boost::shared_ptr.

QSharedDataPointer<Value> v = new Value(22);

You have to assign the 'naked' pointer to a QSharedDataPointer. Once the (last copy of this) QSharedDataPointer goes out of scope the reference count gets zero and the object deleted.
(Note that this is a huge difference to boost::shared_ptr: a QSharedDataPointer "detaches" when you call a non-const op on it (effectifely creating a separate copy).
This is what you want for a value-like class like QString (see below). It might not be at all what you want.)
If you do not want to implement a shared value class, stick to boost::shared_ptr, imo.


The other thing is, that this class was designed for implementing 'value-like' shared objects. Like a QString.
You will hardly ever write
Qt Code:
  1. QString *s = new QString;
To copy to clipboard, switch view to plain text mode 
QString hides this and maybe uses a QSharedDataPointer internally.
The docs illustrated how to do this.
(This is basically a more adavanced form of the pimpl idiom with better support for efficient (and correct) copying of objects.)

HTH