Removed duplicated code from hex.hpp
This commit is contained in:
parent
78ef07cf0f
commit
18c9340950
@ -66,6 +66,13 @@ namespace hex {
|
||||
#define TOKEN_CONCAT_IMPL(x, y) x ## y
|
||||
#define TOKEN_CONCAT(x, y) TOKEN_CONCAT_IMPL(x, y)
|
||||
|
||||
template<>
|
||||
struct std::is_integral<u128> : public std::true_type { };
|
||||
template<>
|
||||
struct std::is_integral<s128> : public std::true_type { };
|
||||
template<>
|
||||
struct std::is_signed<s128> : public std::true_type { };
|
||||
|
||||
namespace hex {
|
||||
|
||||
template<typename ... Args>
|
||||
|
@ -23,52 +23,4 @@ extern char **mainArgv;
|
||||
#define MAGIC_PATH_SEPARATOR ";"
|
||||
#else
|
||||
#define MAGIC_PATH_SEPARATOR ":"
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct std::is_integral<u128> : public std::true_type { };
|
||||
template<>
|
||||
struct std::is_integral<s128> : public std::true_type { };
|
||||
template<>
|
||||
struct std::is_signed<s128> : public std::true_type { };
|
||||
|
||||
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 12000
|
||||
#if __has_include(<concepts>)
|
||||
// Make sure we break when derived_from is implemented in libc++. Then we can fix a compatibility version above
|
||||
#include <concepts>
|
||||
#endif
|
||||
// libcxx 12 still doesn't have many default concepts implemented, as a result we need to define it ourself using clang built-ins.
|
||||
// [concept.derived] (patch from https://reviews.llvm.org/D74292)
|
||||
namespace hex {
|
||||
template<class _Dp, class _Bp>
|
||||
concept derived_from =
|
||||
__is_base_of(_Bp, _Dp) && __is_convertible_to(const volatile _Dp*, const volatile _Bp*);
|
||||
}
|
||||
|
||||
// [concepts.arithmetic] (patch from https://reviews.llvm.org/D88131)
|
||||
namespace hex {
|
||||
template<class _Tp>
|
||||
concept integral = __is_integral(_Tp);
|
||||
|
||||
template<class _Tp>
|
||||
concept signed_integral = integral<_Tp> && __is_signed(_Tp);
|
||||
|
||||
template<class _Tp>
|
||||
concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
|
||||
|
||||
template<class _Tp>
|
||||
concept floating_point = __is_floating_point(_Tp);
|
||||
}
|
||||
#else
|
||||
// Assume supported
|
||||
#include <concepts>
|
||||
|
||||
namespace hex {
|
||||
using std::derived_from;
|
||||
|
||||
using std::integral;
|
||||
using std::signed_integral;
|
||||
using std::unsigned_integral;
|
||||
using std::floating_point;
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user