This is a theoritcal question whether it is possible to get the type of the unnamed struct inside its definition.
int main() {
struct {
using ThisType = ???? //what do i put here?
} _; // the instance
}
I tried to extract the class from a member finction pointer but it didnt work
template<typename>
struct get_class;
template<typename Class>
struct get_class<void(Class::*)()>{using type = Class;};
strict {
void getThis(){}
using ThisType = typename get_class<decltype(getThis)>::type; // error cant know which function to call to determine
// i tried to static_cast but I need to know the class type still.
};
Is it even possible?