summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorsay <[email protected]>2022-02-10 16:48:19 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:48:19 +0300
commit2096e85a73bb6b3b20ae25a92943992717fe4167 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parenta6a6f6e1e77c7d7d0cdfad61c093e061d6fb5782 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/ysaveload.h22
-rw-r--r--util/ysaveload_ut.cpp34
2 files changed, 28 insertions, 28 deletions
diff --git a/util/ysaveload.h b/util/ysaveload.h
index b41922b336f..02efb4049b6 100644
--- a/util/ysaveload.h
+++ b/util/ysaveload.h
@@ -421,7 +421,7 @@ public:
};
template <class T>
-struct TTupleSerializer {
+struct TTupleSerializer {
template <class F, class Tuple, size_t... Indices>
static inline void ReverseUseless(F&& f, Tuple&& t, std::index_sequence<Indices...>) {
ApplyToMany(
@@ -429,23 +429,23 @@ struct TTupleSerializer {
// We need to do this trick because we don't want to break backward compatibility.
// Tuples are being packed in reverse order.
std::get<std::tuple_size<T>::value - Indices - 1>(std::forward<Tuple>(t))...);
- }
-
+ }
+
static inline void Save(IOutputStream* stream, const T& t) {
ReverseUseless([&](const auto& v) { ::Save(stream, v); }, t,
std::make_index_sequence<std::tuple_size<T>::value>{});
- }
-
+ }
+
static inline void Load(IInputStream* stream, T& t) {
ReverseUseless([&](auto& v) { ::Load(stream, v); }, t,
std::make_index_sequence<std::tuple_size<T>::value>{});
- }
-};
-
-template <typename... TArgs>
+ }
+};
+
+template <typename... TArgs>
struct TSerializer<std::tuple<TArgs...>>: TTupleSerializer<std::tuple<TArgs...>> {
-};
-
+};
+
template <>
class TSerializer<TBuffer> {
public:
diff --git a/util/ysaveload_ut.cpp b/util/ysaveload_ut.cpp
index 7cffde04f12..723c68f391e 100644
--- a/util/ysaveload_ut.cpp
+++ b/util/ysaveload_ut.cpp
@@ -27,7 +27,7 @@ class TSaveLoadTest: public TTestBase {
UNIT_TEST(TestNewStyle)
UNIT_TEST(TestNewNewStyle)
UNIT_TEST(TestList)
- UNIT_TEST(TestTuple)
+ UNIT_TEST(TestTuple)
UNIT_TEST(TestVariant)
UNIT_TEST(TestInheritNonVirtualClass)
UNIT_TEST(TestInheritVirtualClass)
@@ -390,22 +390,22 @@ private:
UNIT_ASSERT_VALUES_EQUAL(*std::next(list.begin(), 1), 1);
UNIT_ASSERT_VALUES_EQUAL(*std::next(list.begin(), 2), 10);
}
-
- void TestTuple() {
- TBufferStream s;
-
- using TTuple = std::tuple<int, TString, unsigned int>;
- const TTuple toSave{-10, "qwerty", 15};
- Save(&s, toSave);
-
- TTuple toLoad;
- Load(&s, toLoad);
-
- UNIT_ASSERT_VALUES_EQUAL(std::get<0>(toLoad), std::get<0>(toSave));
- UNIT_ASSERT_VALUES_EQUAL(std::get<1>(toLoad), std::get<1>(toSave));
- UNIT_ASSERT_VALUES_EQUAL(std::get<2>(toLoad), std::get<2>(toSave));
- }
-
+
+ void TestTuple() {
+ TBufferStream s;
+
+ using TTuple = std::tuple<int, TString, unsigned int>;
+ const TTuple toSave{-10, "qwerty", 15};
+ Save(&s, toSave);
+
+ TTuple toLoad;
+ Load(&s, toLoad);
+
+ UNIT_ASSERT_VALUES_EQUAL(std::get<0>(toLoad), std::get<0>(toSave));
+ UNIT_ASSERT_VALUES_EQUAL(std::get<1>(toLoad), std::get<1>(toSave));
+ UNIT_ASSERT_VALUES_EQUAL(std::get<2>(toLoad), std::get<2>(toSave));
+ }
+
template <class TVariant, class T>
void TestVariantImpl(TVariant& v, const T& expected) {
v = expected;