mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
use concepts instead of std::enable_if
This commit is contained in:
parent
5e6aef5dfd
commit
ebde5310b9
21 changed files with 206 additions and 134 deletions
|
@ -256,7 +256,7 @@ struct ff_t : bf_base<T, N>
|
|||
#endif
|
||||
|
||||
template <typename T, uint I, uint N>
|
||||
struct fmt_unveil<bf_t<T, I, N>, void>
|
||||
struct fmt_unveil<bf_t<T, I, N>>
|
||||
{
|
||||
using type = typename fmt_unveil<std::common_type_t<T>>::type;
|
||||
|
||||
|
@ -267,7 +267,7 @@ struct fmt_unveil<bf_t<T, I, N>, void>
|
|||
};
|
||||
|
||||
template <typename F, typename... Fields>
|
||||
struct fmt_unveil<cf_t<F, Fields...>, void>
|
||||
struct fmt_unveil<cf_t<F, Fields...>>
|
||||
{
|
||||
using type = typename fmt_unveil<std::common_type_t<typename F::type>>::type;
|
||||
|
||||
|
@ -278,7 +278,7 @@ struct fmt_unveil<cf_t<F, Fields...>, void>
|
|||
};
|
||||
|
||||
template <typename T, T V, uint N>
|
||||
struct fmt_unveil<ff_t<T, V, N>, void>
|
||||
struct fmt_unveil<ff_t<T, V, N>>
|
||||
{
|
||||
using type = typename fmt_unveil<std::common_type_t<T>>::type;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace fmt
|
|||
#endif
|
||||
}
|
||||
|
||||
template <typename T, typename = void>
|
||||
template <typename T>
|
||||
struct fmt_unveil
|
||||
{
|
||||
static_assert(sizeof(T) > 0, "fmt_unveil<> error: incomplete type");
|
||||
|
@ -54,7 +54,8 @@ struct fmt_unveil
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= 8 && alignof(T) <= 8>>
|
||||
requires(std::is_integral_v<T> && sizeof(T) <= 8 && alignof(T) <= 8)
|
||||
struct fmt_unveil<T>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
|
@ -65,7 +66,8 @@ struct fmt_unveil<T, std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= 8 &&
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_floating_point_v<T> && sizeof(T) <= 8 && alignof(T) <= 8>>
|
||||
requires(std::is_floating_point_v<T> && sizeof(T) <= 8 && alignof(T) <= 8)
|
||||
struct fmt_unveil<T>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
|
@ -77,7 +79,8 @@ struct fmt_unveil<T, std::enable_if_t<std::is_floating_point_v<T> && sizeof(T) <
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_enum_v<T>>>
|
||||
requires std::is_enum_v<T>
|
||||
struct fmt_unveil<T>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
|
@ -88,7 +91,7 @@ struct fmt_unveil<T, std::enable_if_t<std::is_enum_v<T>>>
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T*, void>
|
||||
struct fmt_unveil<T*>
|
||||
{
|
||||
using type = std::add_const_t<T>*;
|
||||
|
||||
|
@ -105,7 +108,7 @@ namespace fmt
|
|||
}
|
||||
|
||||
template <fmt::CharT T, usz N>
|
||||
struct fmt_unveil<T[N], void>
|
||||
struct fmt_unveil<T[N]>
|
||||
{
|
||||
using type = std::add_const_t<T>*;
|
||||
|
||||
|
@ -116,7 +119,7 @@ struct fmt_unveil<T[N], void>
|
|||
};
|
||||
|
||||
template <typename T, bool Se, usz Align>
|
||||
struct fmt_unveil<se_t<T, Se, Align>, void>
|
||||
struct fmt_unveil<se_t<T, Se, Align>>
|
||||
{
|
||||
using type = typename fmt_unveil<T>::type;
|
||||
|
||||
|
@ -200,13 +203,13 @@ struct fmt_class_string
|
|||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const void*, void>
|
||||
struct fmt_class_string<const void*>
|
||||
{
|
||||
static void format(std::string& out, u64 arg);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_class_string<T*, void> : fmt_class_string<const void*, void>
|
||||
struct fmt_class_string<T*> : fmt_class_string<const void*>
|
||||
{
|
||||
// Classify all pointers as const void*
|
||||
};
|
||||
|
@ -218,18 +221,18 @@ struct fmt_class_string<const char*, void>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<char*, void> : fmt_class_string<const char*>
|
||||
struct fmt_class_string<char*> : fmt_class_string<const char*>
|
||||
{
|
||||
// Classify char* as const char*
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const char8_t*, void> : fmt_class_string<const char*>
|
||||
struct fmt_class_string<const char8_t*> : fmt_class_string<const char*>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<char8_t*, void> : fmt_class_string<const char8_t*>
|
||||
struct fmt_class_string<char8_t*> : fmt_class_string<const char8_t*>
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -240,7 +243,7 @@ struct fmt_class_string<const wchar_t*, void>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<wchar_t*, void> : fmt_class_string<const wchar_t*>
|
||||
struct fmt_class_string<wchar_t*> : fmt_class_string<const wchar_t*>
|
||||
{
|
||||
};
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ public:
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<bs_t<T>, void>
|
||||
struct fmt_unveil<bs_t<T>>
|
||||
{
|
||||
// Format as is
|
||||
using type = bs_t<T>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue