The constructor that initializes a shared_ptr from nullptr is faulty. According to the C++11 Standard (section 20.7.2.2), this constructor should be equivalent to the default constructor:constexpr shared_ptr(nullptr_t) : shared_ptr() { }Unfortunately, the implementation in Visual C++ 2012 looks like this:shared_ptr(nullptr_t) { // construct with nullptr _Resetp((_Ty *)0); }This causes the wasteful allocation of an internal control block, which pointlessly guards a null pointer. It also causes a compiler error in the case that "_Ty" has a protected destructor.
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...