Skip to content

Commit

Permalink
move static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Oct 9, 2024
1 parent 94b1078 commit b182dfe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Core/include/Acts/Utilities/DelegateChainBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@
namespace Acts {

template <typename Fn, typename payload_types = TypeList<>, auto... Callables>
class DelegateChainBuilder {
static_assert(
false,
"Delegate chain return type must be void or default constructible");
};
class DelegateChainBuilder;

template <typename R, typename... payload_types, auto... callables,
typename... callable_args>
requires(std::is_same_v<R, void> || std::is_default_constructible_v<R>)
class DelegateChainBuilder<R(callable_args...), TypeList<payload_types...>,
callables...> {
using return_type =
Expand Down Expand Up @@ -143,6 +138,9 @@ class DelegateChainBuilder<R(callable_args...), TypeList<payload_types...>,
if constexpr (std::is_same_v<R, void>) {
invoke(nullptr, &m_payloads, std::forward<callable_args>(args)...);
} else {
static_assert(
std::is_same_v<R, void> || std::is_default_constructible_v<R>,
"Delegate chain return type must be void or default constructible");
return_type result{};
invoke(&result, &m_payloads, std::forward<callable_args>(args)...);
return result;
Expand Down

0 comments on commit b182dfe

Please sign in to comment.