aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-21 13:09:08 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-21 13:09:08 +0300
commitb99d6e954b74694820a0964402003eb9f14da4de (patch)
tree8814902312bae587822187234b721ef2d9675cf9 /library/cpp
parent96a6a371c53651ccfd7dfdc87fe354cf23de9b5c (diff)
downloadydb-b99d6e954b74694820a0964402003eb9f14da4de.tar.gz
intermediate changes
ref:ff022ac951849edb1ef2cc274bf6c1c6863144a1
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/memory/leaky_ref_counted_singleton-inl.h8
-rw-r--r--library/cpp/yt/memory/leaky_ref_counted_singleton.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/library/cpp/yt/memory/leaky_ref_counted_singleton-inl.h b/library/cpp/yt/memory/leaky_ref_counted_singleton-inl.h
index a68ec5ed6ae..7d50dcc2efd 100644
--- a/library/cpp/yt/memory/leaky_ref_counted_singleton-inl.h
+++ b/library/cpp/yt/memory/leaky_ref_counted_singleton-inl.h
@@ -16,8 +16,8 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
-template <class T>
-TIntrusivePtr<T> LeakyRefCountedSingleton()
+template <class T, class... TArgs>
+TIntrusivePtr<T> LeakyRefCountedSingleton(TArgs&&... args)
{
static std::atomic<T*> Ptr;
auto* ptr = Ptr.load(std::memory_order_acquire);
@@ -26,8 +26,8 @@ TIntrusivePtr<T> LeakyRefCountedSingleton()
}
static std::once_flag Initialized;
- std::call_once(Initialized, [] {
- auto ptr = New<T>();
+ std::call_once(Initialized, [&] {
+ auto ptr = New<T>(std::forward<TArgs>(args)...);
Ref(ptr.Get());
Ptr.store(ptr.Get());
#if defined(_asan_enabled_)
diff --git a/library/cpp/yt/memory/leaky_ref_counted_singleton.h b/library/cpp/yt/memory/leaky_ref_counted_singleton.h
index 1d5761bd9de..4ad5b5f0528 100644
--- a/library/cpp/yt/memory/leaky_ref_counted_singleton.h
+++ b/library/cpp/yt/memory/leaky_ref_counted_singleton.h
@@ -6,8 +6,8 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
-template <class T>
-TIntrusivePtr<T> LeakyRefCountedSingleton();
+template <class T, class... TArgs>
+TIntrusivePtr<T> LeakyRefCountedSingleton(TArgs&&... args);
////////////////////////////////////////////////////////////////////////////////