1/**
2 * D header file for interaction with C++ std::type_traits.
3 *
4 * Copyright: Copyright Digital Mars 2018.
5 * License: Distributed under the
6 *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
7 *    (See accompanying file LICENSE)
8 * Authors:   Manu Evans
9 * Source:    $(DRUNTIMESRC core/stdcpp/type_traits.d)
10 */
11
12module core.stdcpp.type_traits;
13
14extern(C++, "std"):
15
16///
17struct integral_constant(T, T Val)
18{
19    ///
20    enum T value = Val;
21    ///
22    alias value_type = T;
23    ///
24    alias type = typeof(this);
25}
26
27///
28alias bool_constant(bool b) = integral_constant!(bool, b);
29
30// Useful for dealing with enable_if constraints.
31///
32alias true_type  = bool_constant!true;
33///
34alias false_type = bool_constant!false;
35
36///
37struct is_empty(T)
38{
39    static if (is(T == struct))
40        private enum __is_empty = T.tupleof.length == 0;
41    else
42        private enum __is_empty = false;
43
44    ///
45    enum bool value = __is_empty;
46    ///
47    alias value_type = bool;
48    ///
49    alias type = integral_constant!(bool, value);
50}
51