From Jason Turner
Watch on YouTube

Summary

This episode explores C++23's 'deducing this' feature, which solves the common problem of duplicating code when implementing both const and non-const versions of member functions. Jason demonstrates how this new feature eliminates the need for code duplication or helper functions by allowing member functions to deduce the constness and value category of the object they're called on. The feature works by specifying the first parameter as a reference to the class type, effectively treating the 'this' pointer as an explicit parameter.

Resources

Tags