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:is_polymorphic is_polymorphic] |
| 9 | template <class T> |
| 10 | struct is_polymorphic : public __tof {}; |
| 11 | |
| 12 | __inherit If T is a (possibly cv-qualified) polymorphic type |
| 13 | then inherits from __true_type, |
| 14 | otherwise inherits from __false_type. Type `T` must be a complete type. |
| 15 | |
| 16 | __std_ref 10.3. |
| 17 | |
| 18 | __compat The implementation requires some knowledge of the compilers ABI, |
| 19 | it does actually seem to work with the majority of compilers though. |
| 20 | |
| 21 | __header ` #include <boost/type_traits/is_polymorphic.hpp>` or ` #include <boost/type_traits.hpp>` |
| 22 | |
| 23 | __examples |
| 24 | |
| 25 | [: Given: `class poly{ virtual ~poly(); };` ] |
| 26 | |
| 27 | [:`is_polymorphic<poly>` inherits from `__true_type`.] |
| 28 | |
| 29 | [:`is_polymorphic<poly const>::type` is the type `__true_type`.] |
| 30 | |
| 31 | [:`is_polymorphic<poly>::value` is an integral constant |
| 32 | expression that evaluates to /true/.] |
| 33 | |
| 34 | [:`is_polymorphic<T>::value_type` is the type `bool`.] |
| 35 | |
| 36 | [endsect] |
| 37 | |