aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgritukan <gritukan@yandex-team.com>2023-08-07 16:26:35 +0300
committergritukan <gritukan@yandex-team.com>2023-08-07 17:54:21 +0300
commit36bd23adab11a9c3e8552963e7ced107f381cb33 (patch)
tree3e07f6f92c78496a959611b8c5b956d1e26c1862
parent67c8b51e98caa2abfc405b42b9497563207dd424 (diff)
downloadydb-36bd23adab11a9c3e8552963e7ced107f381cb33.tar.gz
YT-19686: Support building TRef from std::string
-rw-r--r--library/cpp/yt/memory/ref-inl.h5
-rw-r--r--library/cpp/yt/memory/ref.cpp1
-rw-r--r--library/cpp/yt/memory/ref.h3
3 files changed, 9 insertions, 0 deletions
diff --git a/library/cpp/yt/memory/ref-inl.h b/library/cpp/yt/memory/ref-inl.h
index 0508bfbb47..14b21903c0 100644
--- a/library/cpp/yt/memory/ref-inl.h
+++ b/library/cpp/yt/memory/ref-inl.h
@@ -35,6 +35,11 @@ Y_FORCE_INLINE TRef TRef::FromString(const TString& str)
return FromStringBuf(str);
}
+Y_FORCE_INLINE TRef TRef::FromString(const std::string& str)
+{
+ return TRef(str.data(), str.size());
+}
+
Y_FORCE_INLINE TRef TRef::FromStringBuf(TStringBuf strBuf)
{
return TRef(strBuf.data(), strBuf.length());
diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp
index 31680b6c61..605bc4ae2e 100644
--- a/library/cpp/yt/memory/ref.cpp
+++ b/library/cpp/yt/memory/ref.cpp
@@ -1,4 +1,5 @@
#include "ref.h"
+
#include "blob.h"
#include <library/cpp/yt/malloc/malloc.h>
diff --git a/library/cpp/yt/memory/ref.h b/library/cpp/yt/memory/ref.h
index a47188180c..2b2a0792ab 100644
--- a/library/cpp/yt/memory/ref.h
+++ b/library/cpp/yt/memory/ref.h
@@ -36,6 +36,9 @@ public:
//! Creates a non-owning TRef for a given string.
static TRef FromString(const TString& str);
+ //! Creates a non-owning TRef for a given std::string.
+ static TRef FromString(const std::string& str);
+
//! Creates a non-owning TRef for a given stringbuf.
static TRef FromStringBuf(TStringBuf strBuf);