Brian Silverman | 4a2409e | 2018-08-04 23:24:02 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2009 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_virtual_base_of is_virtual_base_of] |
| 9 | template <class Base, class Derived> |
| 10 | struct is_virtual_base_of : public __tof {}; |
| 11 | |
| 12 | __inherit If Base is a virtual base class of type Derived then inherits from __true_type, |
| 13 | otherwise inherits from __false_type. |
| 14 | |
| 15 | Types `Base` and `Derived` must not be incomplete types. |
| 16 | |
| 17 | __std_ref 10. |
| 18 | |
| 19 | __header ` #include <boost/type_traits/is_virtual_base_of.hpp>` or ` #include <boost/type_traits.hpp>` |
| 20 | |
| 21 | [all_compilers] |
| 22 | |
| 23 | [note |
| 24 | There are a small number of cases where it's simply not possible for this trait to work, and |
| 25 | where attempting to instantiate the trait will cause compiler errors (see bug reports |
| 26 | [@https://svn.boost.org/trac/boost/ticket/3730 #3730] and [@https://svn.boost.org/trac/boost/ticket/11323 11323]). |
| 27 | Further more the issues may well |
| 28 | be compiler specific. In this situation the user should supply a full specialization of |
| 29 | the trait to work around the problem.] |
| 30 | |
| 31 | __examples |
| 32 | |
| 33 | [:Given: ` class Base{}; class Derived : public virtual Base{};` ] |
| 34 | |
| 35 | [:`is_virtual_base_of<Base, Derived>` inherits from `__true_type`.] |
| 36 | |
| 37 | [:`is_virtual_base_of<Base, Derived>::type` is the type `__true_type`.] |
| 38 | |
| 39 | [:`is_virtual_base_of<Base, Derived>::value` is an integral constant |
| 40 | expression that evaluates to /true/.] |
| 41 | |
| 42 | [:`is_virtual_base_of<SomeClassType, SomeClassType>::value` is an integral constant |
| 43 | expression that evaluates to /true/.] |
| 44 | |
| 45 | [:`is_virtual_base_of<NotAClassType, NotAClassType>::value` is an integral constant |
| 46 | expression that evaluates to /false/.] |
| 47 | |
| 48 | [:`is_virtual_base_of<T, U>::value_type` is the type `bool`.] |
| 49 | |
| 50 | [endsect] |
| 51 | |