Commit 09da4942 authored by Dominik Charousset's avatar Dominik Charousset

Integrate review feedback

parent 50bedc96
......@@ -116,13 +116,8 @@ public:
template <template <class> class MergePolicy,
message_priority Prio = message_priority::normal, class Container,
class... Ts>
// TODO: replace this monstrosity with 'auto' when switching to C++17
response_handle<Subtype,
MergePolicy<response_type_t<
typename Container::value_type::signatures,
detail::implicit_conversions_t<detail::decay_t<Ts>>...>>>
fan_out_request(const Container& destinations, const duration& timeout,
Ts&&... xs) {
auto fan_out_request(const Container& destinations, const duration& timeout,
Ts&&... xs) {
using handle_type = typename Container::value_type;
using namespace detail;
static_assert(sizeof...(Ts) > 0, "no message to send");
......@@ -159,13 +154,8 @@ public:
template <template <class> class MergePolicy,
message_priority Prio = message_priority::normal, class Rep,
class Period, class Container, class... Ts>
// TODO: replace this monstrosity with 'auto' when switching to C++17
response_handle<Subtype,
MergePolicy<response_type_t<
typename Container::value_type::signatures,
detail::implicit_conversions_t<detail::decay_t<Ts>>...>>>
fan_out_request(const Container& destinations,
std::chrono::duration<Rep, Period> timeout, Ts&&... xs) {
auto fan_out_request(const Container& destinations,
std::chrono::duration<Rep, Period> timeout, Ts&&... xs) {
return request<MergePolicy, Prio>(destinations, duration{timeout},
std::forward<Ts>(xs)...);
}
......
......@@ -57,8 +57,7 @@ struct fan_in_responses_helper {
results.reserve(pending);
}
// TODO: return 'auto' from this function when switching to C++17
std::function<void(T&)> wrap() {
auto wrap() {
return [this](T& x) { (*this)(x); };
}
};
......@@ -85,8 +84,7 @@ struct fan_in_responses_tuple_helper {
results.reserve(pending);
}
// TODO: return 'auto' from this function when switching to C++17
std::function<void(Ts&...)> wrap() {
auto wrap() {
return [this](Ts&... xs) { (*this)(xs...); };
}
};
......
......@@ -73,9 +73,8 @@ public:
void await(F f, OnError g) const {
static_assert(detail::is_callable<F>::value, "F must provide a single, "
"non-template operator()");
static_assert(detail::is_callable<F>::value,
"OnError must provide a single, non-template operator() "
"that takes a caf::error");
static_assert(detail::is_callable_with<OnError, error&>::value,
"OnError must provide an operator() that takes a caf::error");
using result_type = typename detail::get_callable_trait<F>::result_type;
static_assert(std::is_same<void, result_type>::value,
"response handlers are not allowed to have a return "
......@@ -96,9 +95,8 @@ public:
void then(F f, OnError g) const {
static_assert(detail::is_callable<F>::value, "F must provide a single, "
"non-template operator()");
static_assert(detail::is_callable<F>::value,
"OnError must provide a single, non-template operator() "
"that takes a caf::error");
static_assert(detail::is_callable_with<OnError, error&>::value,
"OnError must provide an operator() that takes a caf::error");
using result_type = typename detail::get_callable_trait<F>::result_type;
static_assert(std::is_same<void, result_type>::value,
"response handlers are not allowed to have a return "
......@@ -121,9 +119,8 @@ public:
detail::is_handler_for_ef<OnError, error> receive(F f, OnError g) {
static_assert(detail::is_callable<F>::value, "F must provide a single, "
"non-template operator()");
static_assert(detail::is_callable<F>::value,
"OnError must provide a single, non-template operator() "
"that takes a caf::error");
static_assert(detail::is_callable_with<OnError, error&>::value,
"OnError must provide an operator() that takes a caf::error");
using result_type = typename detail::get_callable_trait<F>::result_type;
static_assert(std::is_same<void, result_type>::value,
"response handlers are not allowed to have a return "
......
......@@ -154,9 +154,9 @@ CAF_TEST(delegated request with integer result) {
CAF_TEST(requesters support fan_out_request) {
using policy::fan_in_responses;
std::vector<adding_server_type> workers{
adding_server = make_server([](int x, int y) { return x + y; }),
adding_server = make_server([](int x, int y) { return x + y; }),
adding_server = make_server([](int x, int y) { return x + y; }),
make_server([](int x, int y) { return x + y; }),
make_server([](int x, int y) { return x + y; }),
make_server([](int x, int y) { return x + y; }),
};
run();
auto sum = std::make_shared<int>(0);
......
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