Drop std::pair support in serialization
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace xrt::drivers::wivrn
|
namespace xrt::drivers::wivrn
|
||||||
{
|
{
|
||||||
using protocol = std::pair<from_headset::packets, to_headset::packets>;
|
using protocol = std::variant<from_headset::packets, to_headset::packets>;
|
||||||
|
|
||||||
extern const char git_version[];
|
extern const char git_version[];
|
||||||
static inline const constinit auto protocol_version = serialization_type_hash<protocol>();
|
static inline const constinit auto protocol_version = serialization_type_hash<protocol>();
|
||||||
|
|||||||
@@ -574,33 +574,6 @@ struct serialization_traits<data_holder>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
|
||||||
struct serialization_traits<std::pair<T1, T2>>
|
|
||||||
{
|
|
||||||
static constexpr void type_hash(details::hash_context & h)
|
|
||||||
{
|
|
||||||
h.feed("pair<");
|
|
||||||
serialization_traits<T1>::type_hash(h);
|
|
||||||
h.feed(",");
|
|
||||||
serialization_traits<T2>::type_hash(h);
|
|
||||||
h.feed(">");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void serialize(const std::pair<T1, T2> & value, serialization_packet & packet)
|
|
||||||
{
|
|
||||||
packet.serialize<T1>(value.first);
|
|
||||||
packet.serialize<T2>(value.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::pair<T1, T2> deserialize(deserialization_packet & packet)
|
|
||||||
{
|
|
||||||
T1 first = packet.deserialize<T1>();
|
|
||||||
T2 second = packet.deserialize<T2>();
|
|
||||||
|
|
||||||
return {first, second};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr uint64_t serialization_type_hash()
|
constexpr uint64_t serialization_type_hash()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ static_assert(serialization_type_hash<std::vector<int>>() == hash("vector<int32>
|
|||||||
static_assert(serialization_type_hash<std::array<int, 42>>() == hash("array<int32,42>"));
|
static_assert(serialization_type_hash<std::array<int, 42>>() == hash("array<int32,42>"));
|
||||||
static_assert(serialization_type_hash<std::string>() == hash("string"));
|
static_assert(serialization_type_hash<std::string>() == hash("string"));
|
||||||
static_assert(serialization_type_hash<std::variant<int, float>>() == hash("variant<int32,float32>"));
|
static_assert(serialization_type_hash<std::variant<int, float>>() == hash("variant<int32,float32>"));
|
||||||
static_assert(serialization_type_hash<std::pair<int, float>>() == hash("pair<int32,float32>"));
|
|
||||||
|
|
||||||
struct test
|
struct test
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user