is_class.qbk 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. [/
  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).
  6. ]
  7. [section:is_class is_class]
  8. template <class T>
  9. struct is_class : public __tof {};
  10. __inherit If T is a (possibly cv-qualified) class type (and not a union type) then inherits from __true_type,
  11. otherwise inherits from __false_type.
  12. __std_ref 3.9.2 and 9.2.
  13. __header ` #include <boost/type_traits/is_class.hpp>` or ` #include <boost/type_traits.hpp>`
  14. __compat This trait works correctly for almost all current compilers (as of June 2015), with just a minority
  15. of older compilers not correctly detecting all the corner cases. You can check the macro `BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION`
  16. which is defined to 1 when the class works correctly in all cases.
  17. __examples
  18. [:Given: `class MyClass;` then:]
  19. [:`is_class<MyClass>` inherits from `__true_type`.]
  20. [:`is_class<MyClass const>::type` is the type `__true_type`.]
  21. [:`is_class<MyClass>::value` is an integral constant
  22. expression that evaluates to /true/.]
  23. [:`is_class<MyClass&>::value` is an integral constant
  24. expression that evaluates to /false/.]
  25. [:`is_class<MyClass*>::value` is an integral constant
  26. expression that evaluates to /false/.]
  27. [:`is_class<T>::value_type` is the type `bool`.]
  28. [endsect]