From Jason Turner
Watch on YouTube

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.

Resources

Tags