| Home | Libraries | People | FAQ | More

### is_virtual_base_of

    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: All current compilers are supported by this 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 reports #3730 and 11323). 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 from `true_type`.

> `is_virtual_base_of<Base, Derived>::type` is the type `true_type`.

> `is_virtual_base_of<Base, Derived>::value` is an integral constant expression that evaluates to true.

> `is_virtual_base_of<SomeClassType, SomeClassType>::value` is an integral constant expression that evaluates to true.

> `is_virtual_base_of<NotAClassType, NotAClassType>::value` is an integral constant expression that evaluates to false.

> `is_virtual_base_of<T, U>::value_type` is the type `bool`.