22 void save(
const T& arg) {
23 using U = core::raw_t<T>;
26 if constexpr (has_func_save<U, ISerializer&>::value) {
28 }
else if constexpr (has_tag_save<ISerializer, U>::value) {
29 tag_invoke(save_v, *
this,
static_cast<const U&
>(arg));
37 const auto size = arg.size();
40 for (
const auto& e: std::as_const(arg))
44 else if constexpr (std::is_class_v<U>) {
45 meta::each_member(GAIA_FWD(arg), [&](
auto&&... items) {
50 static_assert(!
sizeof(U),
"Type is not supported for serialization, yet");
55 using U = core::raw_t<T>;
58 if constexpr (has_func_load<U, ISerializer&>::value) {
60 }
else if constexpr (has_tag_load<ISerializer, U>::value) {
61 tag_invoke(load_v, *
this,
static_cast<U&
>(arg));
69 auto size = arg.size();
72 if constexpr (has_func_resize<U, size_t>::value) {
85 arg[i] = std::move(e);
91 using arg_type =
typename std::remove_pointer<
decltype(arg.data())>::type;
99 else if constexpr (std::is_class_v<U>) {
100 meta::each_member(GAIA_FWD(arg), [&](
auto&&... items) {
105 static_assert(!
sizeof(U),
"Type is not supported for serialization, yet");
108#if GAIA_ASSERT_ENABLED
109 template <
typename T>
110 void check(
const T& arg) {
115 const auto pos0 = tell();
117 const auto pos1 = tell();
120 const auto pos2 = tell();
121 GAIA_ASSERT(pos2 == pos1);
128 template <
typename T>
129 void save_raw(
const T& value) {
130 save_raw(&value,
sizeof(value), ser::type_id<T>());
133 template <
typename T>
134 void load_raw(T& value) {
135 load_raw(&value,
sizeof(value), ser::type_id<T>());
138 virtual void save_raw(
const void* src, uint32_t size, serialization_type_id
id) {
144 virtual void load_raw(
void* src, uint32_t size, serialization_type_id
id) {
150 virtual const char* data()
const {
154 virtual void reset() {}
156 virtual uint32_t tell()
const {
160 virtual uint32_t bytes()
const {
164 virtual void seek(uint32_t pos) {