aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2024-08-11 10:30:07 +0300
committerbabenko <babenko@yandex-team.com>2024-08-11 10:43:05 +0300
commit5f79e5d28fea8ef4af5756b30787e29dba8e9333 (patch)
tree5ffdb6aa4e46eb44f6d504a629a26639313d885a /library/cpp
parent3b81341a63468572e764a2a6d3556b44e1fa76bc (diff)
downloadydb-5f79e5d28fea8ef4af5756b30787e29dba8e9333.tar.gz
Support std::string serialization
d080266c9235a1852d0115157e87a090c7fe63e1
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/memory/ref-inl.h5
-rw-r--r--library/cpp/yt/memory/ref.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/library/cpp/yt/memory/ref-inl.h b/library/cpp/yt/memory/ref-inl.h
index c575696382..7fcd91908c 100644
--- a/library/cpp/yt/memory/ref-inl.h
+++ b/library/cpp/yt/memory/ref-inl.h
@@ -96,6 +96,11 @@ Y_FORCE_INLINE TMutableRef TMutableRef::FromString(TString& str)
return TMutableRef(str.begin(), str.length());
}
+Y_FORCE_INLINE TMutableRef TMutableRef::FromString(std::string& str)
+{
+ return TMutableRef(str.data(), str.length());
+}
+
Y_FORCE_INLINE TMutableRef TMutableRef::Slice(size_t startOffset, size_t endOffset) const
{
YT_ASSERT(endOffset >= startOffset && endOffset <= Size());
diff --git a/library/cpp/yt/memory/ref.h b/library/cpp/yt/memory/ref.h
index 2dfe861e75..78ea46675f 100644
--- a/library/cpp/yt/memory/ref.h
+++ b/library/cpp/yt/memory/ref.h
@@ -90,10 +90,13 @@ public:
template <class T>
static TMutableRef FromPod(T& data);
- //! Creates a non-owning TMutableRef for a given string.
+ //! Creates a non-owning TMutableRef for a given TString.
//! Ensures that the string is not shared.
static TMutableRef FromString(TString& str);
+ //! Creates a non-owning TMutableRef for a given std::string.
+ static TMutableRef FromString(std::string& str);
+
//! Creates a TMutableRef for a part of existing range.
TMutableRef Slice(size_t startOffset, size_t endOffset) const;
};