[ox/std] Fix is_integer_v
This commit is contained in:
2
deps/ox/src/ox/std/serialize.hpp
vendored
2
deps/ox/src/ox/std/serialize.hpp
vendored
@@ -71,7 +71,7 @@ constexpr ox::Error serialize(Writer_c auto &w, const VectorMemMap<PlatSpec> &vm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr ox::Error serialize(Writer_c auto &w, T val) noexcept requires(is_integer_v<T>) {
|
constexpr ox::Error serialize(Writer_c auto &w, T val) noexcept requires(is_integral_v<T>) {
|
||||||
ox::Array<char, sizeof(T)> tmp;
|
ox::Array<char, sizeof(T)> tmp;
|
||||||
for (auto i = 0u; i < sizeof(T); ++i) {
|
for (auto i = 0u; i < sizeof(T); ++i) {
|
||||||
tmp[i] = static_cast<char>((val >> i * 8) & 255);
|
tmp[i] = static_cast<char>((val >> i * 8) & 255);
|
||||||
|
|||||||
82
deps/ox/src/ox/std/typetraits.hpp
vendored
82
deps/ox/src/ox/std/typetraits.hpp
vendored
@@ -34,6 +34,41 @@ inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T);
|
|||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct remove_cv {
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct remove_cv<const T> {
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct remove_cv<volatile T> {
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct remove_cv<const volatile T> {
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct remove_const {
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct remove_const<const T> {
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using remove_const_t = typename remove_const<T>::type;
|
||||||
|
|
||||||
|
|
||||||
template<class T, T v>
|
template<class T, T v>
|
||||||
struct integral_constant {
|
struct integral_constant {
|
||||||
|
|
||||||
@@ -109,6 +144,12 @@ template<> struct is_integer<int16_t> : true_type {};
|
|||||||
template<> struct is_integer<uint16_t>: true_type {};
|
template<> struct is_integer<uint16_t>: true_type {};
|
||||||
template<> struct is_integer<int32_t> : true_type {};
|
template<> struct is_integer<int32_t> : true_type {};
|
||||||
template<> struct is_integer<uint32_t>: true_type {};
|
template<> struct is_integer<uint32_t>: true_type {};
|
||||||
|
template<> struct is_integer<int8_t const> : true_type {};
|
||||||
|
template<> struct is_integer<uint8_t const> : true_type {};
|
||||||
|
template<> struct is_integer<int16_t const> : true_type {};
|
||||||
|
template<> struct is_integer<uint16_t const>: true_type {};
|
||||||
|
template<> struct is_integer<int32_t const> : true_type {};
|
||||||
|
template<> struct is_integer<uint32_t const>: true_type {};
|
||||||
|
|
||||||
// some of these need to be done with the actual language syntax because no one
|
// some of these need to be done with the actual language syntax because no one
|
||||||
// can agree on what an (u)int64_t is...
|
// can agree on what an (u)int64_t is...
|
||||||
@@ -116,9 +157,13 @@ template<> struct is_integer<long>: true_type {};
|
|||||||
template<> struct is_integer<long long>: true_type {};
|
template<> struct is_integer<long long>: true_type {};
|
||||||
template<> struct is_integer<unsigned long>: true_type {};
|
template<> struct is_integer<unsigned long>: true_type {};
|
||||||
template<> struct is_integer<unsigned long long>: true_type {};
|
template<> struct is_integer<unsigned long long>: true_type {};
|
||||||
|
template<> struct is_integer<long const>: true_type {};
|
||||||
|
template<> struct is_integer<long long const>: true_type {};
|
||||||
|
template<> struct is_integer<unsigned long const>: true_type {};
|
||||||
|
template<> struct is_integer<unsigned long long const>: true_type {};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr bool is_integer_v = is_integral<T>::value;
|
constexpr bool is_integer_v = is_integer<T>::value;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Integer_c = is_integer<T>::value;
|
concept Integer_c = is_integer<T>::value;
|
||||||
@@ -264,41 +309,6 @@ template<class T>
|
|||||||
constexpr bool is_move_constructible_v = detail::is_move_constructible<T>(0);
|
constexpr bool is_move_constructible_v = detail::is_move_constructible<T>(0);
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct remove_cv {
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct remove_cv<const T> {
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct remove_cv<volatile T> {
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct remove_cv<const volatile T> {
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct remove_const {
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct remove_const<const T> {
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
using remove_const_t = typename remove_const<T>::type;
|
|
||||||
|
|
||||||
|
|
||||||
// is String?
|
// is String?
|
||||||
|
|
||||||
template<std::size_t SmallStringSize>
|
template<std::size_t SmallStringSize>
|
||||||
|
|||||||
Reference in New Issue
Block a user