diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-06-18 15:14:13 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-06-18 15:25:03 +0300 |
commit | ca14d16f6036e99355b1c0c7fc787a55a7d7d649 (patch) | |
tree | 66431a8065256ab2fa522766587599224fa71dd8 | |
parent | b06c6b7f153e1e88dd17b27b33ff519a76e9be7e (diff) | |
download | ydb-ca14d16f6036e99355b1c0c7fc787a55a7d7d649.tar.gz |
Move NYT::TExtendedCallback::Via() definitions to where they belong
in order to fix
```
ld.lld: error: undefined symbol: NYT::TExtendedCallback<void ()>::Via(NYT::TIntrusivePtr<NYT::IInvoker>) &&
```
be2b33b64716ddbff9a4a4e3e6003dbf9dbd83df
-rw-r--r-- | yt/yt/core/actions/bind-inl.h | 29 | ||||
-rw-r--r-- | yt/yt/core/actions/invoker-inl.h | 42 | ||||
-rw-r--r-- | yt/yt/core/actions/invoker.h | 7 | ||||
-rw-r--r-- | yt/yt/core/actions/new_with_offloaded_dtor-inl.h | 1 |
4 files changed, 31 insertions, 48 deletions
diff --git a/yt/yt/core/actions/bind-inl.h b/yt/yt/core/actions/bind-inl.h index c37bef5b2d..f8ff2d016d 100644 --- a/yt/yt/core/actions/bind-inl.h +++ b/yt/yt/core/actions/bind-inl.h @@ -5,6 +5,7 @@ #endif #undef BIND_INL_H_ +#include <yt/yt/core/actions/invoker.h> #include <yt/yt/core/concurrency/propagating_storage.h> namespace NYT { @@ -703,6 +704,34 @@ auto Bind( return TExtendedCallback<T>(callback); } +template <class R, class... TArgs> +TExtendedCallback<R(TArgs...)> +TExtendedCallback<R(TArgs...)>::Via(IInvokerPtr invoker) const & +{ + return ViaImpl(*this, std::move(invoker)); +} + +template <class R, class... TArgs> +TExtendedCallback<R(TArgs...)> +TExtendedCallback<R(TArgs...)>::Via(IInvokerPtr invoker) && +{ + return ViaImpl(std::move(*this), std::move(invoker)); +} + +template <class R, class... TArgs> +TExtendedCallback<R(TArgs...)> +TExtendedCallback<R(TArgs...)>::ViaImpl(TExtendedCallback<R(TArgs...)> callback, TIntrusivePtr<IInvoker> invoker) +{ + static_assert( + std::is_void_v<R>, + "Via() can only be used with void return type."); + YT_ASSERT(invoker); + + return BIND_NO_PROPAGATE([callback = std::move(callback), invoker = std::move(invoker)] (TArgs... args) { + invoker->Invoke(BIND_NO_PROPAGATE(callback, WrapToPassed(std::forward<TArgs>(args))...)); + }); +} + //////////////////////////////////////////////////////////////////////////////// } // namespace NYT diff --git a/yt/yt/core/actions/invoker-inl.h b/yt/yt/core/actions/invoker-inl.h deleted file mode 100644 index 3612e73841..0000000000 --- a/yt/yt/core/actions/invoker-inl.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef INVOKER_INL_H_ -#error "Direct inclusion of this file is not allowed, include invoker.h" -// For the sake of sane code completion. -#include "invoker.h" -#endif -#undef INVOKER_INL_H_ - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -template <class R, class... TArgs> -TExtendedCallback<R(TArgs...)> -TExtendedCallback<R(TArgs...)>::Via(IInvokerPtr invoker) const & -{ - return ViaImpl(*this, std::move(invoker)); -} - -template <class R, class... TArgs> -TExtendedCallback<R(TArgs...)> -TExtendedCallback<R(TArgs...)>::Via(IInvokerPtr invoker) && -{ - return ViaImpl(std::move(*this), std::move(invoker)); -} - -template <class R, class... TArgs> -TExtendedCallback<R(TArgs...)> -TExtendedCallback<R(TArgs...)>::ViaImpl(TExtendedCallback<R(TArgs...)> callback, TIntrusivePtr<IInvoker> invoker) -{ - static_assert( - std::is_void_v<R>, - "Via() can only be used with void return type."); - YT_ASSERT(invoker); - - return BIND_NO_PROPAGATE([callback = std::move(callback), invoker = std::move(invoker)] (TArgs... args) { - invoker->Invoke(BIND_NO_PROPAGATE(callback, WrapToPassed(std::forward<TArgs>(args))...)); - }); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT diff --git a/yt/yt/core/actions/invoker.h b/yt/yt/core/actions/invoker.h index 49c231879f..163b4ac17e 100644 --- a/yt/yt/core/actions/invoker.h +++ b/yt/yt/core/actions/invoker.h @@ -1,9 +1,9 @@ #pragma once #include "callback.h" -#include "bind.h" #include <yt/yt/core/threading/public.h> +#include <library/cpp/yt/memory/range.h> #include <type_traits> @@ -99,8 +99,3 @@ DEFINE_REFCOUNTED_TYPE(ISuspendableInvoker) //////////////////////////////////////////////////////////////////////////////// } // namespace NYT - -#define INVOKER_INL_H_ -#include "invoker-inl.h" -#undef INVOKER_INL_H_ - diff --git a/yt/yt/core/actions/new_with_offloaded_dtor-inl.h b/yt/yt/core/actions/new_with_offloaded_dtor-inl.h index d445c9b39d..9875e38758 100644 --- a/yt/yt/core/actions/new_with_offloaded_dtor-inl.h +++ b/yt/yt/core/actions/new_with_offloaded_dtor-inl.h @@ -4,6 +4,7 @@ #include "new_with_offloaded_dtor.h" #endif +#include "bind.h" #include "invoker.h" namespace NYT { |