Commit 15715406 authored by Dominik Charousset's avatar Dominik Charousset

Fix type checking in fan_out_request

parent 467a9c77
......@@ -147,6 +147,10 @@ public:
using message_id_list = std::vector<message_id>;
template <class Fun>
using type_checker = detail::type_checker<
response_type, detail::fan_in_responses_helper_t<detail::decay_t<Fun>>>;
explicit fan_in_responses(message_id_list ids) : ids_(std::move(ids)) {
CAF_ASSERT(ids_.size()
<= static_cast<size_t>(std::numeric_limits<int>::max()));
......@@ -174,7 +178,6 @@ public:
void receive(Self* self, F&& f, G&& g) const {
using helper_type = detail::fan_in_responses_helper_t<detail::decay_t<F>>;
helper_type helper{ids_.size(), std::forward<F>(f)};
detail::type_checker<ResponseType, helper_type>::check();
auto error_handler = [&](error& err) {
if (*helper.pending > 0) {
*helper.pending = 0;
......@@ -200,7 +203,6 @@ private:
using helper_type = fan_in_responses_helper_t<decay_t<F>>;
using error_handler_type = fan_in_responses_error_handler<decay_t<OnError>>;
helper_type helper{ids_.size(), std::move(f)};
type_checker<ResponseType, helper_type>::check();
error_handler_type err_helper{std::forward<OnError>(g), helper.pending};
return {
std::move(helper),
......
......@@ -39,6 +39,9 @@ public:
using response_type = ResponseType;
template <class Fun>
using type_checker = detail::type_checker<response_type, Fun>;
explicit single_response(message_id mid) noexcept : mid_(mid) {
// nop
}
......
......@@ -80,7 +80,7 @@ public:
static_assert(std::is_same<void, result_type>::value,
"response handlers are not allowed to have a return "
"type other than void");
detail::type_checker<response_type, F>::check();
policy_type::template type_checker<F>::check();
policy_.await(self_, std::move(f), std::move(g));
}
......@@ -103,7 +103,7 @@ public:
static_assert(std::is_same<void, result_type>::value,
"response handlers are not allowed to have a return "
"type other than void");
detail::type_checker<response_type, F>::check();
policy_type::template type_checker<F>::check();
policy_.then(self_, std::move(f), std::move(g));
}
......@@ -128,7 +128,7 @@ public:
static_assert(std::is_same<void, result_type>::value,
"response handlers are not allowed to have a return "
"type other than void");
detail::type_checker<response_type, F>::check();
policy_type::template type_checker<F>::check();
policy_.receive(self_, std::move(f), std::move(g));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment