Date: Sun, 4 Feb 2024 19:26:01 +0000
Hello all,
Currently taking a pointer to a non-static member function in C++ is unnecessarily verbose.
auto p = function; // error
auto p = class_name::function; // error
auto p = &class_name::function; // OK
Please allow the first two to compile.
Another thing I would like to have is getting a structure containing both the 'this' pointer and the function pointer when taking a member-function pointer while being inside another member function. This would simply lots of event-handling code where you may have to pass in (this, &class_name::handler) currently.
There could also be a wrapper in the standard library that stores any kind of pointer (raw and smart) along with the member-function pointer. I have wished std::mem_fn was this but unfortunately it is not.
Note: I do not have the time to participate in standardisation in order to open formal proposals, but I wish someöne else does based on my ideas.
Thanks,
Jaiganésh Kumaran.
Currently taking a pointer to a non-static member function in C++ is unnecessarily verbose.
auto p = function; // error
auto p = class_name::function; // error
auto p = &class_name::function; // OK
Please allow the first two to compile.
Another thing I would like to have is getting a structure containing both the 'this' pointer and the function pointer when taking a member-function pointer while being inside another member function. This would simply lots of event-handling code where you may have to pass in (this, &class_name::handler) currently.
There could also be a wrapper in the standard library that stores any kind of pointer (raw and smart) along with the member-function pointer. I have wished std::mem_fn was this but unfortunately it is not.
Note: I do not have the time to participate in standardisation in order to open formal proposals, but I wish someöne else does based on my ideas.
Thanks,
Jaiganésh Kumaran.
Received on 2024-02-04 19:26:06