Assume I have
struct X {
~X() {}
};
What’s the type of and how do I get the member function pointer of X::~X() in C++03?
I don’t want to actually call it, just use in SFINAE to figure if there exists a destructor for a given type.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t get the function pointer of a destructor nor a constructor. Nevertheless a destructor always exist for a type, and you can’t detect if its
privatewith as access specifiers are not considered by SFINAE.On the subject of invoking what would be the destructor of a scalar type, the standard says [class.dtor]/16: