44 if constexpr (std::is_same_v<T, std::vector<uint8_t>>)
46 return T(rep.begin(), rep.end());
51 if (rep.size() != t.size())
53 throw std::logic_error(fmt::format(
54 "Wrong serialised size {} for deserialisation of array of size {}",
58 std::copy_n(rep.begin(), t.size(), t.begin());
61 else if constexpr (std::is_integral_v<T>)
63 if (rep.size() !=
sizeof(T))
65 throw std::logic_error(fmt::format(
66 "Wrong serialised size {} for deserialisation of integral of size "
71 return *(T*)rep.data();
73 else if constexpr (std::is_same_v<T, std::string>)
75 return T(rep.begin(), rep.end());
81 "Can't deserialise this type");