mrdocs icon indicating copy to clipboard operation
mrdocs copied to clipboard

Member functions object parameters

Open sdkrystian opened this issue 2 years ago • 1 comments

C++23 adds explicit object parameters. The Implicit object parameter of non-static member functions (i.e. the object the non-static member function was called on) is an implicit first function parameter of type "cv-qualifier-seq T ref-qualifier" (note: special rules apply to functions that have no ref-qualifier with respect to reference binding & value categories) which is used by overload resolution to enforce the semantics of cv-qualified and/or ref-qualified non-static member functions (e.g. void f() const &), as well as to determine the type of *this.

Explicit object parameters allow for this parameter to be specified explicitly (e.g. void f(this const T& self)); such functions are called using the usual member access syntax. Additionally, all member access within the function body must be done through this parameter; the this expression is not valid.

Only msvc has partial support for this feature right now. Regardless, we may want to consider a unified syntax for displaying the type of the object parameter of a non-static member function with a unified syntax.

sdkrystian avatar May 11 '23 09:05 sdkrystian

Hasn't this been implemented yet?

alandefreitas avatar May 15 '24 00:05 alandefreitas

Implemented by #541

sdkrystian avatar May 27 '24 16:05 sdkrystian