summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryurial <[email protected]>2025-06-13 17:35:20 +0300
committeryurial <[email protected]>2025-06-13 17:47:43 +0300
commite14a2ba12d3e5631783b933ebffe4ba1b7bcd4ec (patch)
treec86ffd2c4ced4c40aab30496b2856456cf2ef6da
parent5af77c069f798dda36e69d1628c12252a5117702 (diff)
Add Save/Load methods for TStrongTypedef
commit_hash:7bda0c36d13d3a9c586f65b48d6f23f854c0e088
-rw-r--r--library/cpp/yt/misc/strong_typedef-inl.h14
-rw-r--r--library/cpp/yt/misc/strong_typedef.h5
2 files changed, 19 insertions, 0 deletions
diff --git a/library/cpp/yt/misc/strong_typedef-inl.h b/library/cpp/yt/misc/strong_typedef-inl.h
index 0e9adee1867..a2c4287f0f7 100644
--- a/library/cpp/yt/misc/strong_typedef-inl.h
+++ b/library/cpp/yt/misc/strong_typedef-inl.h
@@ -6,6 +6,8 @@
#include "wrapper_traits.h"
+#include <util/ysaveload.h>
+
#include <util/generic/strbuf.h>
#include <functional>
@@ -91,6 +93,18 @@ TStrongTypedef<T, TTag>::operator bool() const
return static_cast<bool>(Underlying_);
}
+template <class T, class TTag>
+void TStrongTypedef<T, TTag>::Save(IOutputStream* out) const
+{
+ ::Save(out, Underlying_);
+}
+
+template <class T, class TTag>
+void TStrongTypedef<T, TTag>::Load(IInputStream* in)
+{
+ ::Load(in, Underlying_);
+}
+
////////////////////////////////////////////////////////////////////////////////
template <class T>
diff --git a/library/cpp/yt/misc/strong_typedef.h b/library/cpp/yt/misc/strong_typedef.h
index 58d96ebd2cf..074d523e226 100644
--- a/library/cpp/yt/misc/strong_typedef.h
+++ b/library/cpp/yt/misc/strong_typedef.h
@@ -4,6 +4,8 @@
#include <util/generic/string.h>
+#include <util/stream/fwd.h>
+
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
@@ -54,6 +56,9 @@ public:
constexpr const T& Underlying() const &;
constexpr T&& Underlying() &&;
+ void Save(IOutputStream* out) const;
+ void Load(IInputStream* in);
+
private:
T Underlying_;
};