VCCC  2024.05
VisualCamp Common C++ library
default_initializable.hpp
Go to the documentation of this file.
1 //
2 // Created by yonggyulee on 2023/12/24.
3 //
4 
5 #ifndef VCCC_CONCEPTS_DEFAULT_INITIALIZABLE_HPP_
6 #define VCCC_CONCEPTS_DEFAULT_INITIALIZABLE_HPP_
7 
11 
12 namespace vccc {
13 namespace detail {
14 
15 template<typename T, typename = void>
16 struct is_direct_list_initializable : std::false_type {};
17 template<typename T>
18 struct is_direct_list_initializable<T, void_t<decltype(T{})>> : std::true_type {};
19 
20 template<typename T, typename = void>
21 struct is_default_initializable : std::false_type {};
22 template<typename T>
23 struct is_default_initializable<T, void_t<decltype(::new T)>> : std::true_type {};
24 
25 } // namespace detail
26 
29 
56 template<typename T>
58  : conjunction<
59  constructible_from<T>,
60  detail::is_direct_list_initializable<T>,
61  detail::is_default_initializable<T>
62  > {};
63 
65 
66 } // namespace vccc
67 
68 #endif // VCCC_CONCEPTS_DEFAULT_INITIALIZABLE_HPP_
void void_t
Definition: void_t.hpp:19
Definition: directory.h:12
Definition: conjunction.hpp:22
specifies that an object of a type can be default constructed
Definition: default_initializable.hpp:62