blob: 029a300e30da487b40ef9f22eb833bd680a11307 [file] [log] [blame]
Brian Silverman4a2409e2018-08-04 23:24:02 -07001[/
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_empty is_empty]
9 template <class T>
10 struct is_empty : public __tof {};
11
12__inherit If T is an empty class type (and not a union type) then inherits from __true_type,
13otherwise inherits from __false_type.
14
15__std_ref 10p5.
16
17__header ` #include <boost/type_traits/is_empty.hpp>` or ` #include <boost/type_traits.hpp>`
18
19__compat In order to correctly detect empty classes this trait relies on either:
20
21* the compiler implementing zero sized empty base classes, or
22* the compiler providing __intrinsics to detect empty classes - this latter case can be tested for
23by checking to see if the macro BOOST_IS_EMPTY is defined.
24
25Can not be used with incomplete types.
26
27__examples
28
29[:Given: `struct empty_class {};` ]
30
31[:`is_empty<empty_class>` inherits from `__true_type`.]
32
33[:`is_empty<empty_class const>::type` is the type `__true_type`.]
34
35[:`is_empty<empty_class>::value` is an integral constant
36expression that evaluates to /true/.]
37
38[:`is_empty<T>::value_type` is the type `bool`.]
39
40[endsect]
41