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).
8 [section:is_base_of is_base_of]
10 template <class Base, class Derived>
11 struct is_base_of : public __tof {};
13 __inherit If Base is base class of type Derived or if both types are the same
14 class type then inherits from __true_type,
15 otherwise inherits from __false_type.
17 This template will detect non-public base classes, and ambiguous base classes.
18 It also detects indirect base classes - which is to say __is_base_of<B, D> inherits
19 from __true_type if B is located anywhere in the inheritance tree of D.
21 Note that `is_base_of<X,X>` will inherit from __true_type if X is a class type.
22 This is a change in behaviour
23 from Boost-1.39.0 in order to track the emerging C++0x standard.
25 Types `Base` and `Derived` must not be incomplete types.
29 __header ` #include <boost/type_traits/is_base_of.hpp>` or ` #include <boost/type_traits.hpp>`
35 [:Given: ` class Base{}; class Derived : public Base{};` ]
37 [:`is_base_of<Base, Derived>` inherits from `__true_type`.]
39 [:`is_base_of<Base, Derived>::type` is the type `__true_type`.]
41 [:`is_base_of<Base, Derived>::value` is an integral constant
42 expression that evaluates to /true/.]
44 [:`is_base_of<Base, Base>::value` is an integral constant
45 expression that evaluates to /true/: a class is regarded as it's own base.]
47 [:`is_base_of<T, T>::value_type` is the type `bool`.]