summaryrefslogtreecommitdiffhomepage
path: root/serialize/binary-serializer.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-29 16:49:12 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-29 16:49:12 +0200
commit4c982b2ffe99f5dee70657424161de9541e00a21 (patch)
treefd46a497140aca5c4c6d9e994dca1daa09aa8ccc /serialize/binary-serializer.hpp
parent32021bc251bf110338f28271e87964578cf07e1e (diff)
serialize: use std::bit_cast
Diffstat (limited to 'serialize/binary-serializer.hpp')
-rw-r--r--serialize/binary-serializer.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/serialize/binary-serializer.hpp b/serialize/binary-serializer.hpp
index 43fffea8..66281cc1 100644
--- a/serialize/binary-serializer.hpp
+++ b/serialize/binary-serializer.hpp
@@ -41,9 +41,16 @@ concept integer = requires(T x) {
template<typename T>
concept serializable = requires(T x) {
+ requires std::same_as<T, std::decay_t<T>>;
requires std::floating_point<T> || integer<T>;
};
+template<typename T>
+constexpr inline T maybe_byteswap(T x)
+{
+ return x;
+}
+
template<integer T>
constexpr inline T maybe_byteswap(T x)
{