Use std::void_t

This commit is contained in:
Nekotekina 2018-08-24 00:31:27 +03:00
parent fba4dbf498
commit 6cc7d1fb26
3 changed files with 30 additions and 42 deletions

View File

@ -284,7 +284,7 @@ constexpr bs_t<T> operator -(T lhs, typename bs_base<T>::type rhs)
}
template<typename BS, typename T>
struct atomic_add<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_add<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -305,7 +305,7 @@ struct atomic_add<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t
};
template<typename BS, typename T>
struct atomic_sub<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_sub<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -326,7 +326,7 @@ struct atomic_sub<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t
};
template<typename BS, typename T>
struct atomic_and<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_and<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -347,7 +347,7 @@ struct atomic_and<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t
};
template<typename BS, typename T>
struct atomic_xor<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_xor<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -368,7 +368,7 @@ struct atomic_xor<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t
};
template<typename T>
struct atomic_add<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_add<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -389,7 +389,7 @@ struct atomic_add<T, T, void_t<decltype(T::__bitset_set_type)>>
};
template<typename T>
struct atomic_sub<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_sub<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -410,7 +410,7 @@ struct atomic_sub<T, T, void_t<decltype(T::__bitset_set_type)>>
};
template<typename T>
struct atomic_and<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_and<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -431,7 +431,7 @@ struct atomic_and<T, T, void_t<decltype(T::__bitset_set_type)>>
};
template<typename T>
struct atomic_xor<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_xor<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -452,7 +452,7 @@ struct atomic_xor<T, T, void_t<decltype(T::__bitset_set_type)>>
};
template<typename BS, typename T>
struct atomic_test_and_set<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_test_and_set<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -467,7 +467,7 @@ struct atomic_test_and_set<BS, T, void_t<decltype(T::__bitset_enum_max), std::en
};
template<typename BS, typename T>
struct atomic_test_and_reset<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_test_and_reset<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -482,7 +482,7 @@ struct atomic_test_and_reset<BS, T, void_t<decltype(T::__bitset_enum_max), std::
};
template<typename BS, typename T>
struct atomic_test_and_complement<BS, T, void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
struct atomic_test_and_complement<BS, T, std::void_t<decltype(T::__bitset_enum_max), std::enable_if_t<std::is_same<BS, bs_t<T>>::value>>>
{
using under = typename bs_base<T>::under;
@ -497,7 +497,7 @@ struct atomic_test_and_complement<BS, T, void_t<decltype(T::__bitset_enum_max),
};
template<typename T>
struct atomic_test_and_set<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_test_and_set<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -512,7 +512,7 @@ struct atomic_test_and_set<T, T, void_t<decltype(T::__bitset_set_type)>>
};
template<typename T>
struct atomic_test_and_reset<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_test_and_reset<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -527,7 +527,7 @@ struct atomic_test_and_reset<T, T, void_t<decltype(T::__bitset_set_type)>>
};
template<typename T>
struct atomic_test_and_complement<T, T, void_t<decltype(T::__bitset_set_type)>>
struct atomic_test_and_complement<T, T, std::void_t<decltype(T::__bitset_set_type)>>
{
using under = std::underlying_type_t<T>;
@ -624,7 +624,7 @@ inline bool test_and_complement(T& lhs, T rhs)
}
template<typename T>
struct atomic_or<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
struct atomic_or<T, T, std::void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
{
using under = std::underlying_type_t<T>;
@ -645,7 +645,7 @@ struct atomic_or<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::
};
template<typename T>
struct atomic_and<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
struct atomic_and<T, T, std::void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
{
using under = std::underlying_type_t<T>;
@ -666,7 +666,7 @@ struct atomic_and<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std:
};
template<typename T>
struct atomic_xor<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
struct atomic_xor<T, T, std::void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
{
using under = std::underlying_type_t<T>;
@ -687,7 +687,7 @@ struct atomic_xor<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std:
};
template<typename T>
struct atomic_test_and_set<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
struct atomic_test_and_set<T, T, std::void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
{
using under = std::underlying_type_t<T>;
@ -702,7 +702,7 @@ struct atomic_test_and_set<T, T, void_t<decltype(T::__bitwise_ops), std::enable_
};
template<typename T>
struct atomic_test_and_reset<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
struct atomic_test_and_reset<T, T, std::void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
{
using under = std::underlying_type_t<T>;
@ -717,7 +717,7 @@ struct atomic_test_and_reset<T, T, void_t<decltype(T::__bitwise_ops), std::enabl
};
template<typename T>
struct atomic_test_and_complement<T, T, void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
struct atomic_test_and_complement<T, T, std::void_t<decltype(T::__bitwise_ops), std::enable_if_t<std::is_enum<T>::value>>>
{
using under = std::underlying_type_t<T>;

View File

@ -153,20 +153,8 @@ struct atomic_test_and_complement;
template <typename T>
class atomic_t;
#ifdef _MSC_VER
using std::void_t;
#else
namespace void_details
{
template <typename...>
struct make_void
{
using type = void;
};
}
template <typename... T>
using void_t = typename void_details::make_void<T...>::type;
#if defined(__INTELLISENSE__) && !defined(_MSC_VER)
namespace std { template <typename...> using void_t = void; }
#endif
// Extract T::simple_type if available, remove cv qualifiers
@ -177,7 +165,7 @@ struct simple_type_helper
};
template <typename T>
struct simple_type_helper<T, void_t<typename T::simple_type>>
struct simple_type_helper<T, std::void_t<typename T::simple_type>>
{
using type = typename T::simple_type;
};
@ -725,7 +713,7 @@ struct narrow_impl<From, To, std::enable_if_t<std::is_signed<From>::value && std
// Simple type enabled (TODO: allow for To as well)
template <typename From, typename To>
struct narrow_impl<From, To, void_t<typename From::simple_type>>
struct narrow_impl<From, To, std::void_t<typename From::simple_type>>
: narrow_impl<simple_t<From>, To>
{
};
@ -953,7 +941,7 @@ struct error_code
};
template<typename ET>
struct is_error<ET, void_t<decltype(ET::__not_an_error)>> : std::false_type
struct is_error<ET, std::void_t<decltype(ET::__not_an_error)>> : std::false_type
{
};

View File

@ -25,7 +25,7 @@ namespace id_manager
};
template <typename T>
struct id_traits<T, void_t<decltype(&T::id_base), decltype(&T::id_step), decltype(&T::id_count)>>
struct id_traits<T, std::void_t<decltype(&T::id_base), decltype(&T::id_step), decltype(&T::id_count)>>
{
static const u32 base = T::id_base;
static const u32 step = T::id_step;
@ -83,7 +83,7 @@ namespace id_manager
};
template <typename T, typename T2>
struct id_verify<T, T2, void_t<typename T2::id_type>> : std::integral_constant<bool, std::is_same<T, typename T2::id_type>::value>
struct id_verify<T, T2, std::void_t<typename T2::id_type>> : std::integral_constant<bool, std::is_same<T, typename T2::id_type>::value>
{
// If T2 contains id_type type, T must be equal to it
};
@ -427,7 +427,7 @@ public:
func(*ptr);
return ptr;
}
return nullptr;
}
@ -537,7 +537,7 @@ public:
result++;
}
}
}
}
return result;
}
@ -690,7 +690,7 @@ class fxm
public:
// Initialize object manager
static void init();
// Remove all objects
static void clear();