is_virtual_base_of.qbk 1.7 KB

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