Brian Silverman | 4a2409e | 2018-08-04 23:24:02 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2007 John Maddock. |
| 3 | Distributed under the Boost Software License, Version 1.0. |
| 4 | (See accompanying file LICENSE_1_0.txt or copy at |
| 5 | http://www.boost.org/LICENSE_1_0.txt). |
| 6 | ] |
| 7 | |
| 8 | [section:has_virtual_destructor has_virtual_destructor] |
| 9 | template <class T> |
| 10 | struct has_virtual_destructor : public __tof {}; |
| 11 | |
| 12 | __inherit If T is a (possibly cv-qualified) type with a virtual destructor |
| 13 | then inherits from __true_type, otherwise inherits from __false_type. |
| 14 | |
| 15 | __compat There is currently no |
| 16 | way to portably implement this trait: the default version |
| 17 | always inherits from __false_type, and has to be explicitly specialized for |
| 18 | types with virtual destructors unless the compiler used has compiler __intrinsics |
| 19 | that enable the trait to do the right thing: |
| 20 | Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, |
| 21 | Intel-11.0, plus Codegear and Clang have the necessary compiler __intrinsics to ensure that this |
| 22 | trait "just works". You may also test to see if the necessary __intrinsics are available |
| 23 | by checking to see if the macro `BOOST_HAS_VIRTUAL_DESTRUCTOR` is defined. |
| 24 | |
| 25 | |
| 26 | __std_ref 12.4. |
| 27 | |
| 28 | __header ` #include <boost/type_traits/has_virtual_destructor.hpp>` or ` #include <boost/type_traits.hpp>` |
| 29 | |
| 30 | [endsect] |
| 31 | |