Commit d13d4928 authored by Joseph Noir's avatar Joseph Noir

Add broker base type to composed behavior

This prevents confusion when defining composable behavior based actors
as it guarantees that the broker base type uses the same signature
ordering as the composed behavior type.
parent a358ec28
......@@ -42,6 +42,8 @@ public:
using actor_base = typename handle_type::base;
using broker_base = typename handle_type::broker_base;
using self_pointer =
typename detail::tl_apply<
signatures,
......
......@@ -156,6 +156,9 @@ public:
template <class... OtherSigs>
friend class typed_actor;
template <class... OtherSigs>
friend class typed_behavior;
template <class, class, class>
friend class mixin::behavior_stack_based_impl;
......@@ -174,6 +177,16 @@ public:
typed_behavior& operator=(typed_behavior&&) = default;
typed_behavior& operator=(const typed_behavior&) = default;
template <class... Ts>
typed_behavior(const typed_behavior<Ts...>& other) : bhvr_(other.bhvr_) {
using other_signatures = detail::type_list<Ts...>;
using m = interface_mismatch_t<other_signatures, signatures>;
// trigger static assert on mismatch
detail::static_error_printer<sizeof...(Ts), m::value,
typename m::xs, typename m::ys> guard;
CAF_IGNORE_UNUSED(guard);
}
template <class T, class... Ts>
typed_behavior(T x, Ts... xs) {
set(detail::make_behavior(std::move(x), std::move(xs)...));
......
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