CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2
  1. #1
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Seattle, WA

    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.

  2. #2
    Join Date
    Oct 2008

    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 ).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width