Summary
This episode demonstrates how straightforward it is to implement a constexpr version of std::unique_ptr in C++20, despite it only being officially added to the standard in C++23. Jason implements a simplified unique_ptr from scratch, then systematically adds the constexpr keyword to constructors, destructors, and member functions to make it usable in constant expressions. The video highlights that making many modern C++ components constexpr-compatible is often as simple as adding the constexpr keyword to existing well-designed code.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[string.view]95% match -
[lex.string]70% match -
[constexpr.functions]64% match -
[unique.ptr.runtime.modifiers]53% match -
[unique.ptr.dltr.dflt]50% match