Commit ea00fd7f authored by Dominik Charousset's avatar Dominik Charousset

Reject stream<T> from message handlers

parent ed2c2bad
......@@ -32,8 +32,9 @@
#include "caf/make_message.hpp"
#include "caf/stream_result.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/type_traits.hpp"
namespace caf {
namespace detail {
......@@ -101,6 +102,9 @@ public:
/// Wraps arbitrary values into a `message` and calls the visitor recursively.
template <class... Ts>
void operator()(Ts&... xs) {
static_assert(detail::conjunction<!detail::is_stream<Ts>::value...>::value,
"returning a stream<T> from a message handler achieves not "
"what you would expect and is most likely a mistake");
auto tmp = make_message(std::move(xs)...);
(*this)(tmp);
}
......@@ -141,12 +145,6 @@ public:
(*this)();
}
/// Calls `(*this)(x.ptr)`.
template <class T>
void operator()(stream<T>& x) {
(*this)(x.slot(), x.ptr());
}
/// Calls `(*this)(x.in(), x.out(), x.ptr())`.
template <class Out, class... Ts>
void operator()(output_stream<Out, Ts...>& x) {
......
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