blob: 0c52d5705c3418cb83c007180d6404d2978ab636 [file] [log] [blame]
Brian Silverman4a2409e2018-08-04 23:24:02 -07001[/
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,
13otherwise inherits from __false_type.
14
15Types `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
24There are a small number of cases where it's simply not possible for this trait to work, and
25where 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]).
27Further more the issues may well
28be compiler specific. In this situation the user should supply a full specialization of
29the 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
40expression that evaluates to /true/.]
41
42[:`is_virtual_base_of<SomeClassType, SomeClassType>::value` is an integral constant
43expression that evaluates to /true/.]
44
45[:`is_virtual_base_of<NotAClassType, NotAClassType>::value` is an integral constant
46expression that evaluates to /false/.]
47
48[:`is_virtual_base_of<T, U>::value_type` is the type `bool`.]
49
50[endsect]
51