March 28th, 2014, 12:38 PM
Detect protected destructor?
Is there a way to detect whether or not a template type has a protected destructor?
I see there is std::is_destructible in C++11, but I can't tell if this will return true or false for the protected case. Also, I'm interested in finding a solution for C++03 as well.
March 29th, 2014, 04:22 AM
Re: Detect protected destructor?
std::is_destructible will work ( on c++11 compliant compilers; of course, it would return true for deleted and private destructors as well ); regarding C++03 support, a SFINAE based solution may work or not depending on the compiler; more specifically, it depends on whether the compiler considers access checks part of the immediate context of the deducing expression or not. In c++ 11 it is, in c++2003 is unspecified ( or, say, loosely specified ).
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!