diff --git a/plugins/libimhex/include/hex/helpers/utils.hpp b/plugins/libimhex/include/hex/helpers/utils.hpp index a42b1f59b..800a7c445 100644 --- a/plugins/libimhex/include/hex/helpers/utils.hpp +++ b/plugins/libimhex/include/hex/helpers/utils.hpp @@ -25,15 +25,114 @@ #define fopen64 fopen #define fseeko64 fseek #define ftello64 ftell -#else - template<> - struct std::is_integral : public std::true_type { }; - template<> - struct std::is_integral : public std::true_type { }; - template<> - struct std::is_signed : public std::true_type { }; #endif +namespace hex { + + template + struct is_integral_helper : public std::false_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template + struct is_integral : public is_integral_helper>::type { }; + + template + struct is_signed_helper : public std::false_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template<> + struct is_signed_helper : public std::true_type { }; + + template + struct is_signed : public is_signed_helper>::type { }; + + template + struct is_floating_point_helper : public std::false_type { }; + + template<> + struct is_floating_point_helper : public std::true_type { }; + + template<> + struct is_floating_point_helper : public std::true_type { }; + + template<> + struct is_floating_point_helper : public std::true_type { }; + + template + struct is_floating_point : public is_floating_point_helper>::type { }; + +} + #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 12000 #if __has_include() // Make sure we break when derived_from is implemented in libc++. Then we can fix a compatibility version above @@ -47,33 +146,29 @@ concept derived_from = __is_base_of(_Bp, _Dp) && __is_convertible_to(const volatile _Dp*, const volatile _Bp*); } -// [concepts.arithmetic] -namespace hex { -template -concept integral = __is_integral(_Tp); - -template -concept signed_integral = integral<_Tp> && __is_signed(_Tp); - -template -concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; - -template -concept floating_point = __is_floating_point(_Tp); -} #else // Assume supported #include namespace hex { using std::derived_from; - - using std::integral; - using std::signed_integral; - using std::unsigned_integral; - using std::floating_point; } #endif +// [concepts.arithmetic] +namespace hex { +template +concept integral = hex::is_integral<_Tp>::value; + +template +concept signed_integral = integral<_Tp> && hex::is_signed<_Tp>::value; + +template +concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; + +template +concept floating_point = std::is_floating_point<_Tp>::value; +} + #define TOKEN_CONCAT_IMPL(x, y) x ## y #define TOKEN_CONCAT(x, y) TOKEN_CONCAT_IMPL(x, y) #define ANONYMOUS_VARIABLE(prefix) TOKEN_CONCAT(prefix, __COUNTER__) @@ -266,4 +361,4 @@ namespace hex { size_t size; }; -} \ No newline at end of file +}