8
I ask this because it's a debilitating restriction for a number of obvious reasons yet I am sure the C++ standard guys had a good reason for doing it, and I'd like to know what it is. Not because it will make any difference but because it will make me feel better knowing that there's a good reason for it.
Here is my current take on it; as I see it weak pointers have 2 main uses:
1) to avoid ownership loops. 2) to reduce overhead associated with bouncing around lots of shared pointers.
The former would be no less served and the latter better served by implementing weak_ptr.get(), so why doesn't it exist? More to the point, wouldn't weak_ptr.get() be more efficient than weak_ptr.lock().get(), or can a compiler optimize this to be the same?