diff options
author | ishfb <ishfb@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
commit | 0170772a2dbf133f32e17ca137ff64790d43831f (patch) | |
tree | 68ce3ab477bcb9e09abf2b0a6e7b34287c53f0df /util/ysaveload.h | |
parent | df6128370874866447314ec18d8e67fc7bde40b4 (diff) | |
download | ydb-0170772a2dbf133f32e17ca137ff64790d43831f.tar.gz |
Restoring authorship annotation for <ishfb@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/ysaveload.h')
-rw-r--r-- | util/ysaveload.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/util/ysaveload.h b/util/ysaveload.h index 02efb4049b..4941ffbc3e 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -650,27 +650,27 @@ namespace NPrivate { } } -template <typename... Args> +template <typename... Args> struct TSerializer<std::variant<Args...>> { using TVar = std::variant<Args...>; - - static_assert(sizeof...(Args) < 256, "We use ui8 to store tag"); - - static void Save(IOutputStream* os, const TVar& v) { + + static_assert(sizeof...(Args) < 256, "We use ui8 to store tag"); + + static void Save(IOutputStream* os, const TVar& v) { ::Save<ui8>(os, v.index()); std::visit([os](const auto& data) { - ::Save(os, data); + ::Save(os, data); }, v); - } - - static void Load(IInputStream* is, TVar& v) { + } + + static void Load(IInputStream* is, TVar& v) { ui8 index; ::Load(is, index); if (Y_UNLIKELY(index >= sizeof...(Args))) { ::NPrivate::ThrowUnexpectedVariantTagException(index); } LoadImpl(is, v, index, std::index_sequence_for<Args...>{}); - } + } private: template <size_t... Is> @@ -679,8 +679,8 @@ private: constexpr TLoader loaders[] = {::NPrivate::LoadVariantAlternative<TVar, Args, Is>...}; loaders[index](is, v); } -}; - +}; + #endif template <class T> |