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