From Jason Turner
Watch on YouTube

Summary

This episode explores std::to_address, a new utility coming in C++20 that extracts the underlying raw pointer from smart pointers and pointer-like objects. Jason demonstrates how this function works with unique_ptr, raw pointers, and even container iterators, showing its usefulness in generic code that needs access to the memory address regardless of the pointer type. The episode also highlights some interesting implementation details and design decisions in the standard library.

Resources

Tags