Suppose we have a simple data class like this:
struct DataObj
{
char member[32];
}
And the type of pointer to the member in the data object:
typedef decltype(&DataObj::member) memberObjPtr;
How can I deduce the type of the member variable the pointer points to? Specifically, how do I get:
typedef myExpression<memberObjPtr>::type myType;
std::is_same<char[32],myType>::value == true
What I tried so far:
std::remove_pointer
std::remove_reference
std::decay
Without success. Is there something like remove_member_object_pointer somewhere hidden in the standard? Which is what I would need but can't seem to find..
Member pointers and regular pointers are completely different types. There is nothing you can add or remove to go from a member pointer to a regular object pointer. You need a dedicated type trait.
Using your test case :
Live example : Godbolt