summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt
diff options
context:
space:
mode:
authorosidorkin <[email protected]>2026-05-21 12:30:25 +0300
committerosidorkin <[email protected]>2026-05-22 13:49:27 +0300
commitcae374b29b654b5105b2445fc55bd01dfd9d11a6 (patch)
treeb987e6a2f15b795232a99cc0946129dcfc7ce872 /library/cpp/yt
parent234c7022693af4f45c16b0e4007214c034ffce5b (diff)
Use std::invoke to call std::invokable in TAtomicObject::Transform
commit_hash:699e7e9a27bcf1220bbe3e408349a36a50408644
Diffstat (limited to 'library/cpp/yt')
-rw-r--r--library/cpp/yt/threading/atomic_object-inl.h8
-rw-r--r--library/cpp/yt/threading/atomic_object.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/library/cpp/yt/threading/atomic_object-inl.h b/library/cpp/yt/threading/atomic_object-inl.h
index 34bb7b262c8..97158519bc2 100644
--- a/library/cpp/yt/threading/atomic_object-inl.h
+++ b/library/cpp/yt/threading/atomic_object-inl.h
@@ -55,18 +55,18 @@ bool TAtomicObject<T>::CompareExchange(T& expected, const T& desired)
template <class T>
template <std::invocable<T&> F>
-std::invoke_result_t<F, T&> TAtomicObject<T>::Transform(const F& func)
+std::invoke_result_t<F, T&> TAtomicObject<T>::Transform(F&& func)
{
auto guard = WriterGuard(Spinlock_);
- return func(Object_);
+ return std::invoke(std::forward<F>(func), Object_);
}
template <class T>
template <std::invocable<const T&> F>
-std::invoke_result_t<F, const T&> TAtomicObject<T>::Read(const F& func) const
+std::invoke_result_t<F, const T&> TAtomicObject<T>::Read(F&& func) const
{
auto guard = ReaderGuard(Spinlock_);
- return std::invoke(func, Object_);
+ return std::invoke(std::forward<F>(func), Object_);
}
template <class T>
diff --git a/library/cpp/yt/threading/atomic_object.h b/library/cpp/yt/threading/atomic_object.h
index a77ade0a00d..452f0f29195 100644
--- a/library/cpp/yt/threading/atomic_object.h
+++ b/library/cpp/yt/threading/atomic_object.h
@@ -33,11 +33,11 @@ public:
//! Atomically transforms the value with function #func.
template <std::invocable<T&> F>
- std::invoke_result_t<F, T&> Transform(const F& func);
+ std::invoke_result_t<F, T&> Transform(F&& func);
//! Atomicaly reads the value with function #func.
template <std::invocable<const T&> F>
- std::invoke_result_t<F, const T&> Read(const F& func) const;
+ std::invoke_result_t<F, const T&> Read(F&& func) const;
T Load() const;