Unique_ptr and forward declaration

The constructor needs access to the deleter in just the same way the destructor does: exception safety requires that the constructor be able to roll-back initialisation of all the members in the case that your constructor’s body throws: [C++14: 12.6.2/10]: In a non-delegating constructor, the destructor for each potentially constructed subobject of class type is … Read more

About thread-safety of weak_ptr

I know I’m late, but this comes up when searching for “weak_ptr thread”, and Casey’s answer just isn’t the whole truth. Both shared_ptr and weak_ptr can be used from threads without further synchronization. For shared_ptr, there’s a lot of documentation (e.g. on cppreference.com or on stackoverflow). You can safely access shared_ptr‘s that point to the … Read more