![]() |
Home | Libraries | People | FAQ | More |
template <class Base, class Derived>
struct is_virtual_base_of : public true_type-or-false_type {};
Inherits: If Base is a virtual base class of type Derived then inherits from true_type, otherwise inherits from false_type.
Types Base and Derived must not be incomplete types.
C++ Standard Reference: 10.
Header: #include
<boost/type_traits/is_virtual_base_of.hpp>
or #include <boost/type_traits.hpp>
Compiler Compatibility: this trait also requires a working is_base_of trait.
![]() |
Note |
|---|---|
There are a small number of cases where it's simply not possible for this trait to work, and where attempting to instantiate the trait will cause compiler errors (see bug report #3730). Further more the issues may well be compiler specific. In this situation the user should supply a full specialization of the trait to work around the problem. |
Examples:
Given:
class Base{}; class Derived : public virtual Base{};
is_virtual_base_of<Base, Derived>inherits fromtrue_type.
is_virtual_base_of<Base, Derived>::typeis the typetrue_type.
is_virtual_base_of<Base, Derived>::valueis an integral constant expression that evaluates to true.
is_virtual_base_of<SomeClassType, SomeClassType>::valueis an integral constant expression that evaluates to true.
is_virtual_base_of<NotAClassType, NotAClassType>::valueis an integral constant expression that evaluates to false.
is_virtual_base_of<T, U>::value_typeis the typebool.