On 24 June 2013 09:37, Andrey Semashev wrote:
On Mon, Jun 24, 2013 at 12:06 PM, Jonathan Wakely
I think there is a small documentation bug though, enable_shared_from_this talks about owning an object of type T, but the shared_ptr docs talk about owning a pointer. The docs for std::enable_shared_from_this correctly say "There shall be at least one shared_ptr instance p that owns &t." (as opposed to "owns t"). The & should be added to the Boost docs.
I think it is more correct to say "the pointer owns the [pointed to] object" rather than "the pointer owns the pointer to the object". If the citation you quoted is taken from the standard, then it probably should be corrected.
No, please read the shared_ptr specification before deciding what should be corrected, it is very clear in the Boost docs and the standard: "constructs a shared_ptr that owns the pointer p." That is not a mistake. If I construct shared_ptr<T>((T*)0, D()) then it owns a null pointer and will invoke the deleter D on the null pointer. That has well-defined semantics and you can't do that if it has to own an object rather than a pointer.