C++23: Deducing This -- Rainer Grimm
Anyone who thinks a small C++ standard follows a significant C++ standard is wrong. C++23 provides powerful extensions to C++20. These extensions include the core language, particularly the standard library. Today, I present a small but very impactful feature of the core language: deducing this.
C++23: Deducing This
By Rainer Grimm
From the article:
Deducing this, sometimes also called explicit object parameter, allows it to make the implicitthispointer of a member function explicit. Like Python, the explicit object parameter must be the first function parameter and is called in C++, by convention,Selfandself.
struct Test {
void implicitParameter(); // implicit this pointer
void explictParameter(this Self& self); // explicit this pointer
};
Deducing this enables new programming techniques in C++23: deduplication of function overloading based on the object’s lvalue/rvalue value category and constness. Additionally, you can reference a lambda and invoke it recursively. Furthermore, deducing this simplifies the implementation of CRTP


In the 2023 Annual C++ Developer Survey conducted by the C++ Foundation, the community identified a number of major pain points when working with C++.
Question from reddit poster: I am preparing to release a new feature, a fat pointer class (virtual_ptr), that makes method dispatch even more efficient. Dispatching a method with one virtual argument via a virtual_ptr takes only three instructions and two independent memory reads. As an interesting side-effect, it is now possible to use YOMM2 with non polymorphic classes hierarchies.
C++23 will be the next C++ standard after C++20. This new standard significantly improves C++ but is less game-changing than C++98, C++11, or C++20. C++23 is more in the tradition of C++17.
Registration is now open for CppCon 2023! The conference starts on October 1 and will be held
Sometimes you want to add an implicit conversion to a type. This can be done by adding an implicit conversion operator. For example,
In my last post "Monitor Object" I implemented a thread-safe queue. I made two serious errors. Sorry. Today, I will fix these issues.