Szymon Gatner wrote:
Is it just me or is it really the worse naming in whole boost library?
It is nothing like any other smart pointer.
No initialization / construction from raw pointer.
No operator * or -> (the very least one would expect from _ptr class).
No get().
The weak pointer concept originates from garbage-collected languages that have pointers, such as some proposed extensions to C/C++. In such a language, a weak_ptr can be constructed from a raw pointer, can have *, ->, does have get() -- because the raw pointers are "strong", that is, they keep an object from being destroyed because the garbage collector tracks all pointers. (See for example section 5.4 in http://www.usenix.org/publications/library/proceedings/c++94/full_papers/ell... ) In our "ordinary" C++, the equivalent of such a garbage-collected raw pointer is shared_ptr, which is why weak_ptr can only give you a shared_ptr and not a raw pointer.