Phi
is_implicitly_default_constructible.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_HPP
3 
4 #include "phi/phi_config.hpp"
5 
6 #if PHI_HAS_EXTENSION_PRAGMA_ONCE()
7 # pragma once
8 #endif
9 
10 #include "phi/compiler_support/constexpr.hpp"
11 #include "phi/compiler_support/inline_variables.hpp"
12 #include "phi/compiler_support/warning.hpp"
13 #include "phi/type_traits/integral_constant.hpp"
14 #include "phi/type_traits/is_default_constructible.hpp"
15 
16 PHI_GCC_SUPPRESS_WARNING_PUSH()
17 PHI_GCC_SUPPRESS_WARNING("-Wignored-qualifiers")
18 
19 #if PHI_HAS_WORKING_IS_DEFAULT_CONSTRUCTIBLE()
20 # define PHI_HAS_WORKING_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE() 1
21 #else
22 # define PHI_HAS_WORKING_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE() 0
23 #endif
24 
25 DETAIL_PHI_BEGIN_NAMESPACE()
26 
27 namespace detail
28 {
29  template <typename TypeT>
30  void test_implicit_default_constructible(TypeT);
31 }
32 
33 template <typename TypeT, class = void, typename = typename is_default_constructible<TypeT>::type>
35 {};
36 
37 template <typename TypeT>
39  TypeT, decltype(detail::test_implicit_default_constructible<TypeT const&>({})), true_type>
40  : public true_type
41 {};
42 
43 template <typename TypeT>
45  TypeT, decltype(detail::test_implicit_default_constructible<TypeT const&>({})), false_type>
46  : public false_type
47 {};
48 
49 template <typename TypeT>
51  : public integral_constant<bool, !is_implicitly_default_constructible<TypeT>::value>
52 {};
53 
54 PHI_GCC_SUPPRESS_WARNING_POP()
55 
56 #if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
57 
58 template <typename TypeT>
59 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_implicitly_default_constructible_v =
61 
62 template <typename TypeT>
63 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_implicitly_default_constructible_v =
65 
66 #endif
67 
68 DETAIL_PHI_END_NAMESPACE()
69 
70 #endif // INCG_PHI_CORE_TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_HPP
Definition: integral_constant.hpp:19
Definition: is_implicitly_default_constructible.hpp:34
Definition: swap.hpp:23
Definition: is_implicitly_default_constructible.hpp:50