@@ -58,7 +58,7 @@ struct ubiq_rref_constructor {
58
58
59
59
// /////////////////// Hand-made is_complete<T> trait
60
60
template <typename T, typename = void >
61
- struct is_complete : std::integral_constant< bool , false >
61
+ struct is_complete : std::false_type
62
62
{};
63
63
64
64
template <typename T>
@@ -101,7 +101,7 @@ struct is_aggregate_initializable_n {
101
101
};
102
102
103
103
template <class T , std::size_t N>
104
- struct is_aggregate_initializable_n <T, N, typename std::enable_if <std::is_class<T>::value && !std::is_empty<T>::value>::type > {
104
+ struct is_aggregate_initializable_n <T, N, std::enable_if_t <std::is_class<T>::value && !std::is_empty<T>::value>> {
105
105
template <std::size_t ...I>
106
106
static constexpr bool is_not_constructible_n (std::index_sequence<I...>) noexcept {
107
107
return (!std::is_constructible<T, decltype (ubiq_lref_constructor{I})...>::value && !std::is_constructible<T, decltype (ubiq_rref_constructor{I})...>::value)
@@ -148,16 +148,16 @@ struct ubiq_rref_base_asserting {
148
148
}
149
149
};
150
150
151
- template <class T , std::size_t I0, std::size_t ... I, class /* Enable*/ = typename std::enable_if <std::is_copy_constructible<T>::value>::type >
151
+ template <class T , std::size_t I0, std::size_t ... I, class /* Enable*/ = std::enable_if_t <std::is_copy_constructible<T>::value>>
152
152
constexpr auto assert_first_not_base (std::index_sequence<I0, I...>) noexcept
153
- -> typename std::add_pointer <decltype(T{ ubiq_lref_base_asserting<T>{}, ubiq_lref_constructor{I}... })>::type
153
+ -> std::add_pointer_t <decltype(T{ ubiq_lref_base_asserting<T>{}, ubiq_lref_constructor{I}... })>
154
154
{
155
155
return nullptr ;
156
156
}
157
157
158
- template <class T , std::size_t I0, std::size_t ... I, class /* Enable*/ = typename std::enable_if <!std::is_copy_constructible<T>::value>::type >
158
+ template <class T , std::size_t I0, std::size_t ... I, class /* Enable*/ = std::enable_if_t <!std::is_copy_constructible<T>::value>>
159
159
constexpr auto assert_first_not_base (std::index_sequence<I0, I...>) noexcept
160
- -> typename std::add_pointer <decltype(T{ ubiq_rref_base_asserting<T>{}, ubiq_rref_constructor{I}... })>::type
160
+ -> std::add_pointer_t <decltype(T{ ubiq_rref_base_asserting<T>{}, ubiq_rref_constructor{I}... })>
161
161
{
162
162
return nullptr ;
163
163
}
@@ -173,20 +173,20 @@ constexpr void assert_first_not_base(int) noexcept {}
173
173
174
174
template <class T , std::size_t N>
175
175
constexpr auto assert_first_not_base (long ) noexcept
176
- -> typename std::enable_if <std::is_class<T>::value>::type
176
+ -> std::enable_if_t <std::is_class<T>::value>
177
177
{
178
178
detail::assert_first_not_base<T>(detail::make_index_sequence<N>{});
179
179
}
180
180
181
181
// /////////////////// Helpers for initializable detection
182
182
// Note that these take O(N) compile time and memory!
183
- template <class T , std::size_t ... I, class /* Enable*/ = typename std::enable_if <std::is_copy_constructible<T>::value>::type >
183
+ template <class T , std::size_t ... I, class /* Enable*/ = std::enable_if_t <std::is_copy_constructible<T>::value>>
184
184
constexpr auto enable_if_initializable_helper (std::index_sequence<I...>) noexcept
185
- -> typename std::add_pointer <decltype(T{ubiq_lref_constructor{I}...})>::type ;
185
+ -> std::add_pointer_t <decltype(T{ubiq_lref_constructor{I}...})>;
186
186
187
- template <class T , std::size_t ... I, class /* Enable*/ = typename std::enable_if <!std::is_copy_constructible<T>::value>::type >
187
+ template <class T , std::size_t ... I, class /* Enable*/ = std::enable_if_t <!std::is_copy_constructible<T>::value>>
188
188
constexpr auto enable_if_initializable_helper (std::index_sequence<I...>) noexcept
189
- -> typename std::add_pointer <decltype(T{ubiq_rref_constructor{I}...})>::type ;
189
+ -> std::add_pointer_t <decltype(T{ubiq_rref_constructor{I}...})>;
190
190
191
191
template <class T , std::size_t N, class U = std::size_t , class /* Enable*/ = decltype(detail::enable_if_initializable_helper<T>(detail::make_index_sequence<N>()))>
192
192
using enable_if_initializable_helper_t = U;
@@ -311,8 +311,8 @@ constexpr std::size_t fields_count_lower_bound_unbounded(int, size_t_<Result>) n
311
311
return Result;
312
312
}
313
313
314
- template <class T , std::size_t Begin, std:: size_t Result >
315
- constexpr auto fields_count_lower_bound_unbounded (long , size_t_<Result >) noexcept
314
+ template <class T , std::size_t Begin>
315
+ constexpr auto fields_count_lower_bound_unbounded (long , size_t_<0 >) noexcept
316
316
-> std::enable_if_t<(Begin >= detail::fields_count_upper_bound_loose<T>()), std::size_t>
317
317
{
318
318
static_assert (
@@ -332,29 +332,29 @@ constexpr std::size_t fields_count_lower_bound_unbounded(int, size_t_<0>) noexce
332
332
333
333
// /////////////////// Choosing between array size, unbounded binary search, and linear search followed by unbounded binary search.
334
334
template <class T >
335
- constexpr auto fields_count_dispatch (long , long , std::integral_constant< bool , false > /* are_preconditions_met*/ ) noexcept {
335
+ constexpr auto fields_count_dispatch (long , long , std::false_type /* are_preconditions_met*/ ) noexcept {
336
336
return 0 ;
337
337
}
338
338
339
339
template <class T >
340
- constexpr auto fields_count_dispatch (long , long , std::integral_constant< bool , true > /* are_preconditions_met*/ ) noexcept
341
- -> typename std::enable_if <std::is_array<T>::value, std::size_t>::type
340
+ constexpr auto fields_count_dispatch (long , long , std::true_type /* are_preconditions_met*/ ) noexcept
341
+ -> std::enable_if_t <std::is_array<T>::value, std::size_t>
342
342
{
343
- return sizeof (T) / sizeof (typename std::remove_all_extents <T>::type );
343
+ return sizeof (T) / sizeof (std::remove_all_extents_t <T>);
344
344
}
345
345
346
346
template <class T >
347
- constexpr auto fields_count_dispatch (long , int , std::integral_constant< bool , true > /* are_preconditions_met*/ ) noexcept
347
+ constexpr auto fields_count_dispatch (long , int , std::true_type /* are_preconditions_met*/ ) noexcept
348
348
-> decltype(sizeof (T{}))
349
349
{
350
350
constexpr std::size_t typical_fields_count = 4 ;
351
- constexpr std::size_t last = detail::fields_count_upper_bound<T, typical_fields_count, typical_fields_count * 2 >(1L , 1L );
351
+ constexpr std::size_t last = detail::fields_count_upper_bound<T, typical_fields_count / 2 , typical_fields_count >(1L , 1L );
352
352
constexpr std::size_t middle = (last + 1 ) / 2 ;
353
353
return detail::fields_count_binary_search<T, 0 , middle>(detail::is_one_element_range<0 , middle>{}, 1L );
354
354
}
355
355
356
356
template <class T >
357
- constexpr std::size_t fields_count_dispatch (int , int , std::integral_constant< bool , true > /* are_preconditions_met*/ ) noexcept {
357
+ constexpr std::size_t fields_count_dispatch (int , int , std::true_type /* are_preconditions_met*/ ) noexcept {
358
358
// T is not default aggregate initializable. This means that at least one of the members is not default-constructible.
359
359
// Use linear search to find the smallest valid initializer, after which we unbounded binary search for the largest.
360
360
constexpr std::size_t begin = detail::fields_count_lower_bound_unbounded<T, 1 >(1L , size_t_<0 >{});
0 commit comments