Commit 0dc60051 authored by Dominik Charousset's avatar Dominik Charousset

Simplify extend syntax for typed actors

parent 669853bf
...@@ -69,10 +69,9 @@ class typed_actor ...@@ -69,10 +69,9 @@ class typed_actor
public: public:
/// Creates a new `typed_actor` type by extending this one with `Es...`.
template <class... Es> template <class... Es>
struct extend { using extend = typed_actor<Sigs..., Es...>;
using type = typed_actor<Sigs..., Es...>;
};
/// Identifies the behavior type actors of this kind use /// Identifies the behavior type actors of this kind use
/// for their behavior stack. /// for their behavior stack.
......
...@@ -36,6 +36,15 @@ using passed_atom = caf::atom_constant<caf::atom("passed")>; ...@@ -36,6 +36,15 @@ using passed_atom = caf::atom_constant<caf::atom("passed")>;
namespace { namespace {
// check invariants of type system
using dummy1 = typed_actor<reacts_to<int, int>,
replies_to<double>::with<double>>;
using dummy2 = dummy1::extend<reacts_to<ok_atom>>;
static_assert(std::is_convertible<dummy2, dummy1>::value,
"handle not assignable to narrower definition");
/****************************************************************************** /******************************************************************************
* simple request/response test * * simple request/response test *
******************************************************************************/ ******************************************************************************/
......
...@@ -145,7 +145,7 @@ using middleman_actor_base = middleman_actor::extend< ...@@ -145,7 +145,7 @@ using middleman_actor_base = middleman_actor::extend<
reacts_to<ok_atom, int64_t>, reacts_to<ok_atom, int64_t>,
reacts_to<ok_atom, int64_t, actor_addr>, reacts_to<ok_atom, int64_t, actor_addr>,
reacts_to<error_atom, int64_t, std::string> reacts_to<error_atom, int64_t, std::string>
>::type; >;
class middleman_actor_impl : public middleman_actor_base::base { class middleman_actor_impl : public middleman_actor_base::base {
public: public:
......
Subproject commit d153409e50f536ff362f7597dfcd2e4670782b6b Subproject commit ad014ee333ad0fc1a5c63031d1c123740a4c046d
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