Andrey Semashev wrote:
Anyway, I think, such a pointer does not behave like a real pointer, so it shouldn't be called as such. It looks more like a reference, except that the referred object is accessed through operator->. Maybe it should be called shared_ref because of it. Thinking about it this way, there is no need for reset() or constructors from pointers - only assignment, emplace() and forwarding constructors. Interoperability with shared_ptr can be provided as an extension (maybe with free functions), but that would be just an extension, i.e. no implicit conversion.
I respectfully disagree. A reference is much more restricted than a smart pointer that cannot be null: it cannot change reference and it never owns the object it references. In summary, it mostly has the semantics of a second name to a previously created object. Smart pointers that cannot be null have exactly the same range of semantics and syntactical appearance as other pointers, except for the guarantee of not being null. -Julian