| Home | Libraries | People | FAQ | More

### has_virtual_destructor

    template <class T>
    struct has_virtual_destructor : public true_type-or-false_type {};

Inherits: If T is a (possibly cv-qualified) type with a virtual destructor then inherits from true_type, otherwise inherits from false_type.

Compiler Compatibility: This trait is provided for completeness, since it's part of the Technical Report on C++ Library Extensions. However, there is currently no way to portably implement this trait. The default version provided always inherits from false_type, and has to be explicitly specialized for types with virtual destructors unless the compiler used has compiler intrinsics that enable the trait to do the right thing: Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics to ensure that this trait "just works". You may also test to see if the necessary intrinsics are available by checking to see if the macro `BOOST_HAS_VIRTUAL_DESTRUCTOR` is defined.

C++ Standard Reference: 12.4.

Header: `#include <boost/type_traits/has_virtual_destructor.hpp>` or `#include <boost/type_traits.hpp>`