std::nullptr_t is a C++11 type that holds exactly the nullptr value. By adding a deleted constructor accepting std::nullptr_t to classes like std::string, you can catch undefined behavior (constructing a string from nullptr) at compile-time rather than relying solely on runtime assertions. C++23 already applies this pattern to std::string and std::string_view. C++26 further improves this by allowing deleted functions to carry a message explaining why they were deleted.
490 Impressions