47 if constexpr (std::is_same_v<T, std::vector<uint8_t>>)
49 return T(rep.begin(), rep.end());
54 if (rep.size() != t.size())
56 throw std::logic_error(fmt::format(
57 "Wrong serialised size {} for deserialisation of array of size {}",
61 std::copy_n(rep.begin(), t.size(), t.begin());
64 else if constexpr (std::is_integral_v<T>)
66 if (rep.size() !=
sizeof(T))
68 throw std::logic_error(fmt::format(
69 "Wrong serialised size {} for deserialisation of integral of size "
74 return *(T*)rep.data();
76 else if constexpr (std::is_same_v<T, std::string>)
78 return T(rep.begin(), rep.end());
84 "Can't deserialise this type");