Quick Q: Why two null constructors for std::unique_ptr?
Quick A: The nullptr_t constructor was added later.
Recently on SO:
Why two null constructors for std::unique_ptr?
For (1), consider that it ensures that both the no-arg constructor
unique_ptr()and null-pointer constructorunique_ptr(nullptr_t)have the same compile-time guarantees, i.e. both areconstexpr. We can see the difference in §20.8.1.2:constexpr unique_ptr() noexcept; explicit unique_ptr(pointer p) noexcept; ... constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { }Why the two were not combined into a single constructor with a default value is likely historical contingency.
With regards to (2), why we should care about
constexprdespite having a non-trivial destructor, consider the answer given here:
constexprconstructors can be used for constant initialization, which, as a form of static initialization, is guaranteed to happen before any dynamic initialization takes place.For example, given a global
std::mutex:std::mutex mutex;In a conforming implementation (read: not MSVC), constructors of other objects can safely lock and unlock
mutex, becuasestd::mutex's constructor isconstexpr.

Have you registered for CppCon 2016 in September? Don’t delay –
While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature: