Commit bddecb9c authored by Dominik Charousset's avatar Dominik Charousset

Coding style nitpicks

parent b950901e
...@@ -59,9 +59,9 @@ class behavior { ...@@ -59,9 +59,9 @@ class behavior {
* The list of arguments can contain match expressions, message handlers, * The list of arguments can contain match expressions, message handlers,
* and up to one timeout (if set, the timeout has to be the last argument). * and up to one timeout (if set, the timeout has to be the last argument).
*/ */
template <class V, class... Vs> template <class T, class... Ts>
behavior(V v, Vs... vs) { behavior(T x, Ts... xs) {
assign(std::move(v), std::move(vs)...); assign(std::move(x), std::move(xs)...);
} }
/** /**
...@@ -75,10 +75,10 @@ class behavior { ...@@ -75,10 +75,10 @@ class behavior {
/** /**
* Assigns new handlers. * Assigns new handlers.
*/ */
template <class... Vs> template <class... Ts>
void assign(Vs... vs) { void assign(Ts... xs) {
static_assert(sizeof...(Vs) > 0, "assign() called without arguments"); static_assert(sizeof...(Ts) > 0, "assign() called without arguments");
m_impl = detail::make_behavior(vs...); m_impl = detail::make_behavior(xs...);
} }
void assign(intrusive_ptr<detail::behavior_impl> ptr) { void assign(intrusive_ptr<detail::behavior_impl> ptr) {
......
...@@ -237,12 +237,12 @@ class blocking_actor::functor_based : public blocking_actor { ...@@ -237,12 +237,12 @@ class blocking_actor::functor_based : public blocking_actor {
using act_fun = std::function<void(blocking_actor*)>; using act_fun = std::function<void(blocking_actor*)>;
template <class F, class... Ts> template <class F, class... Ts>
functor_based(F f, Ts&&... vs) { functor_based(F f, Ts&&... xs) {
using trait = typename detail::get_callable_trait<F>::type; using trait = typename detail::get_callable_trait<F>::type;
using arg0 = typename detail::tl_head<typename trait::arg_types>::type; using arg0 = typename detail::tl_head<typename trait::arg_types>::type;
blocking_actor* dummy = nullptr; blocking_actor* dummy = nullptr;
std::integral_constant<bool, std::is_same<arg0, blocking_actor*>::value> tk; std::integral_constant<bool, std::is_same<arg0, blocking_actor*>::value> tk;
create(dummy, tk, f, std::forward<Ts>(vs)...); create(dummy, tk, f, std::forward<Ts>(xs)...);
} }
void cleanup(uint32_t reason); void cleanup(uint32_t reason);
...@@ -254,13 +254,13 @@ class blocking_actor::functor_based : public blocking_actor { ...@@ -254,13 +254,13 @@ class blocking_actor::functor_based : public blocking_actor {
void create(blocking_actor*, act_fun); void create(blocking_actor*, act_fun);
template <class Actor, typename F, class... Ts> template <class Actor, typename F, class... Ts>
void create(Actor* dummy, std::true_type, F f, Ts&&... vs) { void create(Actor* dummy, std::true_type, F f, Ts&&... xs) {
create(dummy, std::bind(f, std::placeholders::_1, std::forward<Ts>(vs)...)); create(dummy, std::bind(f, std::placeholders::_1, std::forward<Ts>(xs)...));
} }
template <class Actor, typename F, class... Ts> template <class Actor, typename F, class... Ts>
void create(Actor* dummy, std::false_type, F f, Ts&&... vs) { void create(Actor* dummy, std::false_type, F f, Ts&&... xs) {
std::function<void()> fun = std::bind(f, std::forward<Ts>(vs)...); std::function<void()> fun = std::bind(f, std::forward<Ts>(xs)...);
create(dummy, [fun](Actor*) { fun(); }); create(dummy, [fun](Actor*) { fun(); });
} }
......
...@@ -28,21 +28,21 @@ ...@@ -28,21 +28,21 @@
namespace caf { namespace caf {
/** /**
* Checks whether `R` does support an input of type `{Ls...}` via a * Checks whether `R` does support an input of type `{Ts...}` via a
* static assertion (always returns 0). * static assertion (always returns 0).
*/ */
template <class... Rs, class... Ls> template <class... Sigs, class... Ts>
void check_typed_input(const typed_actor<Rs...>&, void check_typed_input(const typed_actor<Sigs...>&,
const detail::type_list<Ls...>&) { const detail::type_list<Ts...>&) {
static_assert(detail::tl_find< static_assert(detail::tl_find<
detail::type_list<Ls...>, detail::type_list<Ts...>,
atom_value atom_value
>::value == -1, >::value == -1,
"atom(...) notation is not sufficient for static type " "atom(...) notation is not sufficient for static type "
"checking, please use atom_constant instead in this context"); "checking, please use atom_constant instead in this context");
static_assert(detail::tl_find_if< static_assert(detail::tl_find_if<
detail::type_list<Rs...>, detail::type_list<Sigs...>,
detail::input_is<detail::type_list<Ls...>>::template eval detail::input_is<detail::type_list<Ts...>>::template eval
>::value >= 0, >::value >= 0,
"typed actor does not support given input"); "typed actor does not support given input");
} }
......
...@@ -31,8 +31,8 @@ namespace detail { ...@@ -31,8 +31,8 @@ namespace detail {
// this utterly useless function works around a bug in Clang that causes // this utterly useless function works around a bug in Clang that causes
// the compiler to reject the trailing return type of apply_args because // the compiler to reject the trailing return type of apply_args because
// "get" is not defined (it's found during ADL) // "get" is not defined (it's found during ADL)
template<long Pos, class... Vs> template<long Pos, class... Ts>
typename tl_at<type_list<Vs...>, Pos>::type get(const type_list<Vs...>&); typename tl_at<type_list<Ts...>, Pos>::type get(const type_list<Ts...>&);
template <class F, long... Is, class Tuple> template <class F, long... Is, class Tuple>
auto apply_args(F& f, detail::int_list<Is...>, Tuple&& tup) auto apply_args(F& f, detail::int_list<Is...>, Tuple&& tup)
...@@ -40,22 +40,22 @@ auto apply_args(F& f, detail::int_list<Is...>, Tuple&& tup) ...@@ -40,22 +40,22 @@ auto apply_args(F& f, detail::int_list<Is...>, Tuple&& tup)
return f(get<Is>(tup)...); return f(get<Is>(tup)...);
} }
template <class F, class Tuple, class... Vs> template <class F, class Tuple, class... Ts>
auto apply_args_prefixed(F& f, detail::int_list<>, Tuple&, Vs&&... vs) auto apply_args_prefixed(F& f, detail::int_list<>, Tuple&, Ts&&... xs)
-> decltype(f(std::forward<Vs>(vs)...)) { -> decltype(f(std::forward<Ts>(xs)...)) {
return f(std::forward<Vs>(vs)...); return f(std::forward<Ts>(xs)...);
} }
template <class F, long... Is, class Tuple, class... Vs> template <class F, long... Is, class Tuple, class... Ts>
auto apply_args_prefixed(F& f, detail::int_list<Is...>, Tuple& tup, Vs&&... vs) auto apply_args_prefixed(F& f, detail::int_list<Is...>, Tuple& tup, Ts&&... xs)
-> decltype(f(std::forward<Vs>(vs)..., get<Is>(tup)...)) { -> decltype(f(std::forward<Ts>(xs)..., get<Is>(tup)...)) {
return f(std::forward<Vs>(vs)..., get<Is>(tup)...); return f(std::forward<Ts>(xs)..., get<Is>(tup)...);
} }
template <class F, long... Is, class Tuple, class... Vs> template <class F, long... Is, class Tuple, class... Ts>
auto apply_args_suffxied(F& f, detail::int_list<Is...>, Tuple& tup, Vs&&... vs) auto apply_args_suffxied(F& f, detail::int_list<Is...>, Tuple& tup, Ts&&... xs)
-> decltype(f(get<Is>(tup)..., std::forward<Vs>(vs)...)) { -> decltype(f(get<Is>(tup)..., std::forward<Ts>(xs)...)) {
return f(get<Is>(tup)..., std::forward<Vs>(vs)...); return f(get<Is>(tup)..., std::forward<Ts>(xs)...);
} }
} // namespace detail } // namespace detail
......
...@@ -194,53 +194,53 @@ struct join_std_tuples<T> { ...@@ -194,53 +194,53 @@ struct join_std_tuples<T> {
using type = T; using type = T;
}; };
template <class... Ts, class... Us, class... Rs> template <class... Prefix, class... Infix, class... Suffix>
struct join_std_tuples<std::tuple<Ts...>, std::tuple<Us...>, Rs...> struct join_std_tuples<std::tuple<Prefix...>, std::tuple<Infix...>, Suffix...>
: join_std_tuples<std::tuple<Ts..., Us...>, Rs...> { : join_std_tuples<std::tuple<Prefix..., Infix...>, Suffix...> {
// nop // nop
}; };
// this function reorganizes its arguments to shift the timeout definition // this function reorganizes its arguments to shift the timeout definition
// to the front (receives it at the tail) // to the front (receives it at the tail)
template <class R, class F, class... Vs> template <class R, class F, class... Ts>
intrusive_ptr<R> make_behavior_ra(timeout_definition<F>& tdef, intrusive_ptr<R> make_behavior_ra(timeout_definition<F>& td,
tail_argument_token&, Vs... vs) { tail_argument_token&, Ts... xs) {
return make_behavior_eor<R>(std::tuple_cat(to_match_case_tuple(vs)...), tdef); return make_behavior_eor<R>(std::tuple_cat(to_match_case_tuple(xs)...), td);
} }
template <class R, class... Vs> template <class R, class... Ts>
intrusive_ptr<R> make_behavior_ra(tail_argument_token&, Vs... vs) { intrusive_ptr<R> make_behavior_ra(tail_argument_token&, Ts... xs) {
return make_behavior_eor<R>(std::tuple_cat(to_match_case_tuple(vs)...)); return make_behavior_eor<R>(std::tuple_cat(to_match_case_tuple(xs)...));
} }
// for some reason, this call is ambigious on GCC without enable_if // for some reason, this call is ambigious on GCC without enable_if
template <class R, class V, class... Vs> template <class R, class V, class... Ts>
typename std::enable_if< typename std::enable_if<
!std::is_same<V, tail_argument_token>::value, !std::is_same<V, tail_argument_token>::value,
intrusive_ptr<R> intrusive_ptr<R>
>::type >::type
make_behavior_ra(V& v, Vs&... vs) { make_behavior_ra(V& v, Ts&... xs) {
return make_behavior_ra<R>(vs..., v); return make_behavior_ra<R>(xs..., v);
} }
// this function reorganizes its arguments to shift the timeout definition // this function reorganizes its arguments to shift the timeout definition
// to the front (receives it at the tail) // to the front (receives it at the tail)
template <class... Vs> template <class... Ts>
intrusive_ptr< intrusive_ptr<
default_behavior_impl< default_behavior_impl<
typename join_std_tuples< typename join_std_tuples<
typename lift_to_mctuple<Vs>::type... typename lift_to_mctuple<Ts>::type...
>::type >::type
>> >>
make_behavior(Vs&... vs) { make_behavior(Ts&... xs) {
using result_type = using result_type =
default_behavior_impl< default_behavior_impl<
typename join_std_tuples< typename join_std_tuples<
typename lift_to_mctuple<Vs>::type... typename lift_to_mctuple<Ts>::type...
>::type >::type
>; >;
tail_argument_token eoa; tail_argument_token eoa;
return make_behavior_ra<result_type>(vs..., eoa); return make_behavior_ra<result_type>(xs..., eoa);
} }
using behavior_impl_ptr = intrusive_ptr<behavior_impl>; using behavior_impl_ptr = intrusive_ptr<behavior_impl>;
......
...@@ -570,12 +570,12 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> { ...@@ -570,12 +570,12 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> {
std::vector<uniform_type_info_ptr> m_members; std::vector<uniform_type_info_ptr> m_members;
}; };
template <class... Rs> template <class... Sigs>
class default_uniform_type_info<typed_actor<Rs...>> : class default_uniform_type_info<typed_actor<Sigs...>> :
public detail::abstract_uniform_type_info<typed_actor<Rs...>> { public detail::abstract_uniform_type_info<typed_actor<Sigs...>> {
public: public:
using super = detail::abstract_uniform_type_info<typed_actor<Rs...>>; using super = detail::abstract_uniform_type_info<typed_actor<Sigs...>>;
using handle_type = typed_actor<Rs...>; using handle_type = typed_actor<Sigs...>;
default_uniform_type_info(std::string tname) : super(std::move(tname)) { default_uniform_type_info(std::string tname) : super(std::move(tname)) {
sub_uti = uniform_typeid<actor>(); sub_uti = uniform_typeid<actor>();
......
...@@ -29,9 +29,9 @@ namespace detail { ...@@ -29,9 +29,9 @@ namespace detail {
template <class Base> template <class Base>
class embedded final : public Base { class embedded final : public Base {
public: public:
template <class... Vs> template <class... Ts>
embedded(intrusive_ptr<ref_counted> storage, Vs&&... vs) embedded(intrusive_ptr<ref_counted> storage, Ts&&... xs)
: Base(std::forward<Vs>(vs)...), : Base(std::forward<Ts>(xs)...),
m_storage(std::move(storage)) { m_storage(std::move(storage)) {
// nop // nop
} }
......
...@@ -200,8 +200,8 @@ class intrusive_partitioned_list { ...@@ -200,8 +200,8 @@ class intrusive_partitioned_list {
insert(second_end(), val); insert(second_end(), val);
} }
template <class Actor, class... Vs> template <class Actor, class... Ts>
bool invoke(Actor* self, iterator first, iterator last, Vs&... vs) { bool invoke(Actor* self, iterator first, iterator last, Ts&... xs) {
pointer prev = first->prev; pointer prev = first->prev;
pointer next = first->next; pointer next = first->next;
auto move_on = [&](bool first_valid) { auto move_on = [&](bool first_valid) {
...@@ -214,12 +214,12 @@ class intrusive_partitioned_list { ...@@ -214,12 +214,12 @@ class intrusive_partitioned_list {
while (first != last) { while (first != last) {
std::unique_ptr<value_type, deleter_type> tmp{first.ptr}; std::unique_ptr<value_type, deleter_type> tmp{first.ptr};
// since this function can be called recursively during // since this function can be called recursively during
// self->invoke_message(tmp, vs...), we have to remove the // self->invoke_message(tmp, xs...), we have to remove the
// element from the list proactively and put it back in if // element from the list proactively and put it back in if
// it's safe, i.e., if invoke_message returned im_skipped // it's safe, i.e., if invoke_message returned im_skipped
prev->next = next; prev->next = next;
next->prev = prev; next->prev = prev;
switch (self->invoke_message(tmp, vs...)) { switch (self->invoke_message(tmp, xs...)) {
case policy::im_dropped: case policy::im_dropped:
move_on(false); move_on(false);
break; break;
......
...@@ -64,10 +64,10 @@ class basic_memory_cache; ...@@ -64,10 +64,10 @@ class basic_memory_cache;
template <class T> template <class T>
struct rc_storage : public ref_counted { struct rc_storage : public ref_counted {
T instance; T instance;
template <class... Vs> template <class... Ts>
rc_storage(Vs&&... vs) rc_storage(Ts&&... xs)
: instance(intrusive_ptr<ref_counted>(this, false), : instance(intrusive_ptr<ref_counted>(this, false),
std::forward<Vs>(vs)...) { std::forward<Ts>(xs)...) {
CAF_REQUIRE(get_reference_count() >= 1); CAF_REQUIRE(get_reference_count() >= 1);
} }
}; };
...@@ -190,8 +190,8 @@ class memory { ...@@ -190,8 +190,8 @@ class memory {
public: public:
// Allocates storage, initializes a new object, and returns the new instance. // Allocates storage, initializes a new object, and returns the new instance.
template <class T, class... Vs> template <class T, class... Ts>
static T* create(Vs&&... vs) { static T* create(Ts&&... xs) {
using embedded_t = using embedded_t =
typename std::conditional< typename std::conditional<
T::memory_cache_flag == needs_embedding, T::memory_cache_flag == needs_embedding,
...@@ -201,7 +201,7 @@ class memory { ...@@ -201,7 +201,7 @@ class memory {
auto mc = get_or_set_cache_map_entry<T>(); auto mc = get_or_set_cache_map_entry<T>();
auto es = mc->new_embedded_storage(); auto es = mc->new_embedded_storage();
auto ptr = reinterpret_cast<embedded_t*>(es.second); auto ptr = reinterpret_cast<embedded_t*>(es.second);
new (ptr) embedded_t(std::move(es.first), std::forward<Vs>(vs)...); new (ptr) embedded_t(std::move(es.first), std::forward<Ts>(xs)...);
return ptr; return ptr;
} }
......
...@@ -105,8 +105,8 @@ class optional_message_visitor : public static_visitor<optional<message>> { ...@@ -105,8 +105,8 @@ class optional_message_visitor : public static_visitor<optional<message>> {
optional_message_visitor_enable_tpl<T>::value, optional_message_visitor_enable_tpl<T>::value,
opt_msg opt_msg
>::type >::type
operator()(T& v, Ts&... vs) const { operator()(T& x, Ts&... xs) const {
return make_message(std::move(v), std::move(vs)...); return make_message(std::move(x), std::move(xs)...);
} }
template <class T> template <class T>
......
...@@ -57,27 +57,27 @@ class pair_storage { ...@@ -57,27 +57,27 @@ class pair_storage {
union { embedded<FirstType> first; }; union { embedded<FirstType> first; };
union { embedded<SecondType> second; }; union { embedded<SecondType> second; };
template <class... Vs> template <class... Ts>
pair_storage(intrusive_ptr<ref_counted> storage, pair_storage(intrusive_ptr<ref_counted> storage,
std::integral_constant<size_t, 0>, Vs&&... vs) std::integral_constant<size_t, 0>, Ts&&... xs)
: first(storage), : first(storage),
second(std::move(storage), std::forward<Vs>(vs)...) { second(std::move(storage), std::forward<Ts>(xs)...) {
// nop // nop
} }
template <class V0, class... Vs> template <class T, class... Ts>
pair_storage(intrusive_ptr<ref_counted> storage, pair_storage(intrusive_ptr<ref_counted> storage,
std::integral_constant<size_t, 1>, V0&& v0, Vs&&... vs) std::integral_constant<size_t, 1>, T&& x, Ts&&... xs)
: first(storage, std::forward<V0>(v0)), : first(storage, std::forward<T>(x)),
second(std::move(storage), std::forward<Vs>(vs)...) { second(std::move(storage), std::forward<Ts>(xs)...) {
// nop // nop
} }
template <class V0, class V1, class... Vs> template <class T0, class T1, class... Ts>
pair_storage(intrusive_ptr<ref_counted> storage, pair_storage(intrusive_ptr<ref_counted> storage,
std::integral_constant<size_t, 2>, V0&& v0, V1&& v1, Vs&&... vs) std::integral_constant<size_t, 2>, T0&& x0, T1&& x1, Ts&&... xs)
: first(storage, std::forward<V0>(v0), std::forward<V1>(v1)), : first(storage, std::forward<T0>(x0), std::forward<T1>(x1)),
second(std::move(storage), std::forward<Vs>(vs)...) { second(std::move(storage), std::forward<Ts>(xs)...) {
// nop // nop
} }
......
...@@ -41,17 +41,12 @@ struct conjunction; ...@@ -41,17 +41,12 @@ struct conjunction;
template <> template <>
struct conjunction<> { struct conjunction<> {
static constexpr bool value = false; static constexpr bool value = true;
};
template <bool V0>
struct conjunction<V0> {
static constexpr bool value = V0;
}; };
template <bool V0, bool V1, bool... Vs> template <bool X, bool... Xs>
struct conjunction<V0, V1, Vs...> { struct conjunction<X, Xs...> {
static constexpr bool value = V0 && conjunction<V1, Vs...>::value; static constexpr bool value = X && conjunction<Xs...>::value;
}; };
/** /**
...@@ -60,16 +55,16 @@ struct conjunction<V0, V1, Vs...> { ...@@ -60,16 +55,16 @@ struct conjunction<V0, V1, Vs...> {
template <bool... BoolConstants> template <bool... BoolConstants>
struct disjunction; struct disjunction;
template <bool V0, bool... Vs>
struct disjunction<V0, Vs...> {
static constexpr bool value = V0 || disjunction<Vs...>::value;
};
template <> template <>
struct disjunction<> { struct disjunction<> {
static constexpr bool value = false; static constexpr bool value = false;
}; };
template <bool X, bool... Xs>
struct disjunction<X, Xs...> {
static constexpr bool value = X || disjunction<Xs...>::value;
};
/** /**
* Equal to std::is_same<T, anything>. * Equal to std::is_same<T, anything>.
*/ */
......
...@@ -70,7 +70,7 @@ class event_based_actor::functor_based : public extend<event_based_actor>:: ...@@ -70,7 +70,7 @@ class event_based_actor::functor_based : public extend<event_based_actor>::
with<mixin::functor_based> { with<mixin::functor_based> {
public: public:
template <class... Ts> template <class... Ts>
functor_based(Ts&&... vs) : combined_type(std::forward<Ts>(vs)...) { functor_based(Ts&&... xs) : combined_type(std::forward<Ts>(xs)...) {
// nop // nop
} }
behavior make_behavior() override; behavior make_behavior() override;
......
...@@ -70,35 +70,35 @@ class local_actor : public abstract_actor { ...@@ -70,35 +70,35 @@ class local_actor : public abstract_actor {
* spawn untyped actors * * spawn untyped actors *
****************************************************************************/ ****************************************************************************/
template <class T, spawn_options Os = no_spawn_options, class... Vs> template <class T, spawn_options Os = no_spawn_options, class... Ts>
actor spawn(Vs&&... vs) { actor spawn(Ts&&... xs) {
constexpr auto os = make_unbound(Os); constexpr auto os = make_unbound(Os);
auto res = spawn_class<T, os>(host(), empty_before_launch_callback{}, auto res = spawn_class<T, os>(host(), empty_before_launch_callback{},
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res)); return eval_opts(Os, std::move(res));
} }
template <spawn_options Os = no_spawn_options, class... Vs> template <spawn_options Os = no_spawn_options, class... Ts>
actor spawn(Vs&&... vs) { actor spawn(Ts&&... xs) {
constexpr auto os = make_unbound(Os); constexpr auto os = make_unbound(Os);
auto res = spawn_functor<os>(host(), empty_before_launch_callback{}, auto res = spawn_functor<os>(host(), empty_before_launch_callback{},
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res)); return eval_opts(Os, std::move(res));
} }
template <class T, spawn_options Os, class... Vs> template <class T, spawn_options Os, class... Ts>
actor spawn_in_group(const group& grp, Vs&&... vs) { actor spawn_in_group(const group& grp, Ts&&... xs) {
constexpr auto os = make_unbound(Os); constexpr auto os = make_unbound(Os);
auto res = spawn_class<T, os>(host(), group_subscriber{grp}, auto res = spawn_class<T, os>(host(), group_subscriber{grp},
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res)); return eval_opts(Os, std::move(res));
} }
template <spawn_options Os = no_spawn_options, class... Vs> template <spawn_options Os = no_spawn_options, class... Ts>
actor spawn_in_group(const group& grp, Vs&&... vs) { actor spawn_in_group(const group& grp, Ts&&... xs) {
constexpr auto os = make_unbound(Os); constexpr auto os = make_unbound(Os);
auto res = spawn_functor<os>(host(), group_subscriber{grp}, auto res = spawn_functor<os>(host(), group_subscriber{grp},
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res)); return eval_opts(Os, std::move(res));
} }
...@@ -106,30 +106,30 @@ class local_actor : public abstract_actor { ...@@ -106,30 +106,30 @@ class local_actor : public abstract_actor {
* spawn typed actors * * spawn typed actors *
****************************************************************************/ ****************************************************************************/
template <class T, spawn_options Os = no_spawn_options, class... Vs> template <class T, spawn_options Os = no_spawn_options, class... Ts>
typename actor_handle_from_signature_list< typename actor_handle_from_signature_list<
typename T::signatures typename T::signatures
>::type >::type
spawn_typed(Vs&&... vs) { spawn_typed(Ts&&... xs) {
constexpr auto os = make_unbound(Os); constexpr auto os = make_unbound(Os);
auto res = spawn_class<T, os>(host(), empty_before_launch_callback{}, auto res = spawn_class<T, os>(host(), empty_before_launch_callback{},
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res)); return eval_opts(Os, std::move(res));
} }
template <spawn_options Os = no_spawn_options, typename F, class... Vs> template <spawn_options Os = no_spawn_options, typename F, class... Ts>
typename infer_typed_actor_handle< typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type, typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head< typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types typename detail::get_callable_trait<F>::arg_types
>::type >::type
>::type >::type
spawn_typed(F fun, Vs&&... vs) { spawn_typed(F fun, Ts&&... xs) {
constexpr auto os = make_unbound(Os); constexpr auto os = make_unbound(Os);
auto res = caf::spawn_typed_functor<os>(host(), auto res = caf::spawn_typed_functor<os>(host(),
empty_before_launch_callback{}, empty_before_launch_callback{},
std::move(fun), std::move(fun),
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res)); return eval_opts(Os, std::move(res));
} }
...@@ -138,43 +138,43 @@ class local_actor : public abstract_actor { ...@@ -138,43 +138,43 @@ class local_actor : public abstract_actor {
****************************************************************************/ ****************************************************************************/
/** /**
* Sends `{vs...} to `dest` using the priority `mp`. * Sends `{xs...} to `dest` using the priority `mp`.
*/ */
template <class... Vs> template <class... Ts>
void send(message_priority mp, const channel& dest, Vs&&... vs) { void send(message_priority mp, const channel& dest, Ts&&... xs) {
static_assert(sizeof...(Vs) > 0, "sizeof...(Vs) == 0"); static_assert(sizeof...(Ts) > 0, "sizeof...(Ts) == 0");
send_impl(mp, actor_cast<abstract_channel*>(dest), std::forward<Vs>(vs)...); send_impl(mp, actor_cast<abstract_channel*>(dest), std::forward<Ts>(xs)...);
} }
/** /**
* Sends `{vs...} to `dest` using normal priority. * Sends `{xs...} to `dest` using normal priority.
*/ */
template <class... Vs> template <class... Ts>
void send(const channel& dest, Vs&&... vs) { void send(const channel& dest, Ts&&... xs) {
send(message_priority::normal, dest, std::forward<Vs>(vs)...); send(message_priority::normal, dest, std::forward<Ts>(xs)...);
} }
/** /**
* Sends `{vs...} to `dest` using the priority `mp`. * Sends `{xs...} to `dest` using the priority `mp`.
*/ */
template <class... Ts, class... Vs> template <class... Sigs, class... Ts>
void send(message_priority mp, const typed_actor<Ts...>& dest, Vs&&... vs) { void send(message_priority mp, const typed_actor<Sigs...>& dest, Ts&&... xs) {
using token = using token =
detail::type_list< detail::type_list<
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Vs>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
token tk; token tk;
check_typed_input(dest, tk); check_typed_input(dest, tk);
send_impl(mp, actor_cast<abstract_channel*>(dest), std::forward<Vs>(vs)...); send_impl(mp, actor_cast<abstract_channel*>(dest), std::forward<Ts>(xs)...);
} }
/** /**
* Sends `{vs...} to `dest` using normal priority. * Sends `{xs...} to `dest` using normal priority.
*/ */
template <class... Ts, class... Vs> template <class... Sigs, class... Ts>
void send(const typed_actor<Ts...>& dest, Vs&&... vs) { void send(const typed_actor<Sigs...>& dest, Ts&&... xs) {
send(message_priority::normal, dest, std::forward<Vs>(vs)...); send(message_priority::normal, dest, std::forward<Ts>(xs)...);
} }
/** /**
...@@ -194,19 +194,19 @@ class local_actor : public abstract_actor { ...@@ -194,19 +194,19 @@ class local_actor : public abstract_actor {
* Sends a message to `dest` that is delayed by `rel_time` * Sends a message to `dest` that is delayed by `rel_time`
* using the priority `mp`. * using the priority `mp`.
*/ */
template <class... Vs> template <class... Ts>
void delayed_send(message_priority mp, const channel& dest, void delayed_send(message_priority mp, const channel& dest,
const duration& rtime, Vs&&... vs) { const duration& rtime, Ts&&... xs) {
delayed_send_impl(mp, dest, rtime, make_message(std::forward<Vs>(vs)...)); delayed_send_impl(mp, dest, rtime, make_message(std::forward<Ts>(xs)...));
} }
/** /**
* Sends a message to `dest` that is delayed by `rel_time`. * Sends a message to `dest` that is delayed by `rel_time`.
*/ */
template <class... Vs> template <class... Ts>
void delayed_send(const channel& dest, const duration& rtime, Vs&&... vs) { void delayed_send(const channel& dest, const duration& rtime, Ts&&... xs) {
delayed_send_impl(message_priority::normal, dest, rtime, delayed_send_impl(message_priority::normal, dest, rtime,
make_message(std::forward<Vs>(vs)...)); make_message(std::forward<Ts>(xs)...));
} }
/**************************************************************************** /****************************************************************************
...@@ -501,17 +501,17 @@ class local_actor : public abstract_actor { ...@@ -501,17 +501,17 @@ class local_actor : public abstract_actor {
/** @endcond */ /** @endcond */
private: private:
template <class V, class... Vs> template <class T, class... Ts>
typename std::enable_if< typename std::enable_if<
!std::is_same<typename std::decay<V>::type, message>::value !std::is_same<typename std::decay<T>::type, message>::value
>::type >::type
send_impl(message_priority mp, abstract_channel* dest, V&& v, Vs&&... vs) { send_impl(message_priority mp, abstract_channel* dest, T&& x, Ts&&... xs) {
if (!dest) { if (!dest) {
return; return;
} }
dest->enqueue(mailbox_element::make_joint(address(), message_id::make(mp), dest->enqueue(mailbox_element::make_joint(address(), message_id::make(mp),
std::forward<V>(v), std::forward<T>(x),
std::forward<Vs>(vs)...), std::forward<Ts>(xs)...),
host()); host());
} }
......
...@@ -64,18 +64,18 @@ class mailbox_element : public memory_managed { ...@@ -64,18 +64,18 @@ class mailbox_element : public memory_managed {
static unique_ptr make(actor_addr sender, message_id id, message msg); static unique_ptr make(actor_addr sender, message_id id, message msg);
template <class... Vs> template <class... Ts>
static unique_ptr make_joint(actor_addr sender, message_id id, Vs&&... vs) { static unique_ptr make_joint(actor_addr sender, message_id id, Ts&&... xs) {
using value_storage = using value_storage =
detail::tuple_vals< detail::tuple_vals<
typename unbox_message_element< typename unbox_message_element<
typename detail::strip_and_convert<Vs>::type typename detail::strip_and_convert<Ts>::type
>::type... >::type...
>; >;
std::integral_constant<size_t, 2> tk; std::integral_constant<size_t, 2> tk;
using storage = detail::pair_storage<mailbox_element, value_storage>; using storage = detail::pair_storage<mailbox_element, value_storage>;
auto ptr = detail::memory::create<storage>(tk, std::move(sender), id, auto ptr = detail::memory::create<storage>(tk, std::move(sender), id,
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
ptr->first.msg.reset(&(ptr->second), false); ptr->first.msg.reset(&(ptr->second), false);
return unique_ptr{&(ptr->first)}; return unique_ptr{&(ptr->first)};
} }
......
...@@ -95,14 +95,14 @@ struct has_none { ...@@ -95,14 +95,14 @@ struct has_none {
return false; return false;
} }
template <class V, class... Vs> template <class T, class... Ts>
bool operator()(const V&, const Vs&... vs) const { bool operator()(const T&, const Ts&... xs) const {
return (*this)(vs...); return (*this)(xs...);
} }
template <class V, class... Vs> template <class T, class... Ts>
bool operator()(const optional<V>& v, const Vs&... vs) const { bool operator()(const optional<T>& x, const Ts&... xs) const {
return !v || (*this)(vs...); return !x || (*this)(xs...);
} }
}; };
...@@ -113,9 +113,9 @@ class lfinvoker { ...@@ -113,9 +113,9 @@ class lfinvoker {
// nop // nop
} }
template <class... Vs> template <class... Ts>
typename detail::get_callable_trait<F>::result_type operator()(Vs&&... vs) { typename detail::get_callable_trait<F>::result_type operator()(Ts&&... xs) {
return m_fun(unopt(std::forward<Vs>(vs))...); return m_fun(unopt(std::forward<Ts>(xs))...);
} }
private: private:
...@@ -129,9 +129,9 @@ class lfinvoker<true, F> { ...@@ -129,9 +129,9 @@ class lfinvoker<true, F> {
// nop // nop
} }
template <class... Vs> template <class... Ts>
unit_t operator()(Vs&&... vs) { unit_t operator()(Ts&&... xs) {
m_fun(unopt(std::forward<Vs>(vs))...); m_fun(unopt(std::forward<Ts>(xs))...);
return unit; return unit;
} }
......
...@@ -343,8 +343,8 @@ class message { ...@@ -343,8 +343,8 @@ class message {
struct move_from_tuple_helper { struct move_from_tuple_helper {
template <class... Ts> template <class... Ts>
inline message operator()(Ts&... vs) { inline message operator()(Ts&... xs) {
return make_message(std::move(vs)...); return make_message(std::move(xs)...);
} }
}; };
...@@ -442,24 +442,24 @@ struct unbox_message_element<atom_constant<V>> { ...@@ -442,24 +442,24 @@ struct unbox_message_element<atom_constant<V>> {
}; };
/** /**
* Returns a new `message` containing the values `(v, vs...)`. * Returns a new `message` containing the values `(x, xs...)`.
* @relates message * @relates message
*/ */
template <class V, class... Vs> template <class V, class... Ts>
typename std::enable_if< typename std::enable_if<
!std::is_same<message, typename std::decay<V>::type>::value !std::is_same<message, typename std::decay<V>::type>::value
|| (sizeof...(Vs) > 0), || (sizeof...(Ts) > 0),
message message
>::type >::type
make_message(V&& v, Vs&&... vs) { make_message(V&& x, Ts&&... xs) {
using storage using storage
= detail::tuple_vals<typename unbox_message_element< = detail::tuple_vals<typename unbox_message_element<
typename detail::strip_and_convert<V>::type typename detail::strip_and_convert<V>::type
>::type, >::type,
typename unbox_message_element< typename unbox_message_element<
typename detail::strip_and_convert<Vs>::type typename detail::strip_and_convert<Ts>::type
>::type...>; >::type...>;
auto ptr = make_counted<storage>(std::forward<V>(v), std::forward<Vs>(vs)...); auto ptr = make_counted<storage>(std::forward<V>(x), std::forward<Ts>(xs)...);
return message{detail::message_data::cow_ptr{std::move(ptr)}}; return message{detail::message_data::cow_ptr{std::move(ptr)}};
} }
......
...@@ -71,11 +71,11 @@ class message_builder { ...@@ -71,11 +71,11 @@ class message_builder {
} }
/** /**
* Adds `what` to the elements of the buffer. * Adds `x` to the elements of the buffer.
*/ */
template <class T> template <class T>
message_builder& append(T what) { message_builder& append(T x) {
return append_impl<T>(std::move(what)); return append_impl<T>(std::move(x));
} }
/** /**
......
...@@ -84,17 +84,17 @@ class message_handler { ...@@ -84,17 +84,17 @@ class message_handler {
* functors, or other message handlers. * functors, or other message handlers.
*/ */
template <class T, class... Ts> template <class T, class... Ts>
message_handler(const T& v, Ts&&... vs) { message_handler(const T& v, Ts&&... xs) {
assign(v, std::forward<Ts>(vs)...); assign(v, std::forward<Ts>(xs)...);
} }
/** /**
* Assigns new message handlers. * Assigns new message handlers.
*/ */
template <class... Vs> template <class... Ts>
void assign(Vs... vs) { void assign(Ts... xs) {
static_assert(sizeof...(Vs) > 0, "assign without arguments called"); static_assert(sizeof...(Ts) > 0, "assign without arguments called");
m_impl = detail::make_behavior(vs...); m_impl = detail::make_behavior(xs...);
} }
/** /**
......
...@@ -41,8 +41,8 @@ class behavior_stack_based_impl : public Base { ...@@ -41,8 +41,8 @@ class behavior_stack_based_impl : public Base {
nonblocking_response_handle_tag>; nonblocking_response_handle_tag>;
template <class... Ts> template <class... Ts>
behavior_stack_based_impl(Ts&&... vs) behavior_stack_based_impl(Ts&&... xs)
: Base(std::forward<Ts>(vs)...), : Base(std::forward<Ts>(xs)...),
m_timeout_id(0) { m_timeout_id(0) {
// nop // nop
} }
......
...@@ -39,12 +39,12 @@ class functor_based : public Base { ...@@ -39,12 +39,12 @@ class functor_based : public Base {
} }
template <class F, class... Ts> template <class F, class... Ts>
functor_based(F f, Ts&&... vs) { functor_based(F f, Ts&&... xs) {
init(std::move(f), std::forward<Ts>(vs)...); init(std::move(f), std::forward<Ts>(xs)...);
} }
template <class F, class... Ts> template <class F, class... Ts>
void init(F f, Ts&&... vs) { void init(F f, Ts&&... xs) {
using trait = typename detail::get_callable_trait<F>::type; using trait = typename detail::get_callable_trait<F>::type;
using arg_types = typename trait::arg_types; using arg_types = typename trait::arg_types;
using result_type = typename trait::result_type; using result_type = typename trait::result_type;
...@@ -54,7 +54,7 @@ class functor_based : public Base { ...@@ -54,7 +54,7 @@ class functor_based : public Base {
typename detail::tl_head<arg_types>::type, pointer>::value; typename detail::tl_head<arg_types>::type, pointer>::value;
std::integral_constant<bool, returns_behavior> token1; std::integral_constant<bool, returns_behavior> token1;
std::integral_constant<bool, uses_first_arg> token2; std::integral_constant<bool, uses_first_arg> token2;
set(token1, token2, std::move(f), std::forward<Ts>(vs)...); set(token1, token2, std::move(f), std::forward<Ts>(xs)...);
} }
protected: protected:
......
This diff is collapsed.
...@@ -51,8 +51,8 @@ class not_prioritizing { ...@@ -51,8 +51,8 @@ class not_prioritizing {
self->mailbox().cache().push_second_back(ptr.release()); self->mailbox().cache().push_second_back(ptr.release());
} }
template <class Actor, class... Vs> template <class Actor, class... Ts>
bool invoke_from_cache(Actor* self, Vs&... args) { bool invoke_from_cache(Actor* self, Ts&... args) {
auto& cache = self->mailbox().cache(); auto& cache = self->mailbox().cache();
auto i = cache.second_begin(); auto i = cache.second_begin();
auto e = cache.second_end(); auto e = cache.second_end();
......
...@@ -68,9 +68,9 @@ class response_handle<Self, message, nonblocking_response_handle_tag> { ...@@ -68,9 +68,9 @@ class response_handle<Self, message, nonblocking_response_handle_tag> {
// nop // nop
} }
template <class... Vs> template <class... Ts>
continue_helper then(Vs&&... vs) const { continue_helper then(Ts&&... xs) const {
behavior bhvr{std::forward<Vs>(vs)...}; behavior bhvr{std::forward<Ts>(xs)...};
m_self->bhvr_stack().push_back(std::move(bhvr), m_mid); m_self->bhvr_stack().push_back(std::move(bhvr), m_mid);
return {m_mid}; return {m_mid};
} }
...@@ -138,9 +138,9 @@ class response_handle<Self, message, blocking_response_handle_tag> { ...@@ -138,9 +138,9 @@ class response_handle<Self, message, blocking_response_handle_tag> {
m_self->dequeue_response(bhvr, m_mid); m_self->dequeue_response(bhvr, m_mid);
} }
template <class... Vs> template <class... Ts>
void await(Vs&&... vs) const { void await(Ts&&... xs) const {
behavior bhvr{std::forward<Vs>(vs)...}; behavior bhvr{std::forward<Ts>(xs)...};
m_self->dequeue_response(bhvr, m_mid); m_self->dequeue_response(bhvr, m_mid);
} }
......
...@@ -36,104 +36,104 @@ namespace caf { ...@@ -36,104 +36,104 @@ namespace caf {
/** /**
* Sends `to` a message under the identity of `from` with priority `prio`. * Sends `to` a message under the identity of `from` with priority `prio`.
*/ */
template <class... Vs> template <class... Ts>
void send_as(const actor& from, message_priority prio, void send_as(const actor& from, message_priority prio,
const channel& to, Vs&&... vs) { const channel& to, Ts&&... xs) {
if (!to) { if (!to) {
return; return;
} }
message_id mid; message_id mid;
to->enqueue(from.address(), to->enqueue(from.address(),
prio == message_priority::high ? mid.with_high_priority() : mid, prio == message_priority::high ? mid.with_high_priority() : mid,
make_message(std::forward<Vs>(vs)...), nullptr); make_message(std::forward<Ts>(xs)...), nullptr);
} }
/** /**
* Sends `to` a message under the identity of `from`. * Sends `to` a message under the identity of `from`.
*/ */
template <class... Vs> template <class... Ts>
void send_as(const actor& from, const channel& to, Vs&&... vs) { void send_as(const actor& from, const channel& to, Ts&&... xs) {
send_as(from, message_priority::normal, to, std::forward<Vs>(vs)...); send_as(from, message_priority::normal, to, std::forward<Ts>(xs)...);
} }
/** /**
* Sends `to` a message under the identity of `from` with priority `prio`. * Sends `to` a message under the identity of `from` with priority `prio`.
*/ */
template <class... Rs, class... Vs> template <class... Sigs, class... Ts>
void send_as(const actor& from, message_priority prio, void send_as(const actor& from, message_priority prio,
const typed_actor<Rs...>& to, Vs&&... vs) { const typed_actor<Sigs...>& to, Ts&&... xs) {
using token = using token =
detail::type_list< detail::type_list<
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Vs>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
token tk; token tk;
check_typed_input(to, tk); check_typed_input(to, tk);
send_as(from, prio, actor_cast<channel>(to), std::forward<Vs>(vs)...); send_as(from, prio, actor_cast<channel>(to), std::forward<Ts>(xs)...);
} }
/** /**
* Sends `to` a message under the identity of `from`. * Sends `to` a message under the identity of `from`.
*/ */
template <class... Rs, class... Vs> template <class... Sigs, class... Ts>
void send_as(const actor& from, const typed_actor<Rs...>& to, Vs&&... vs) { void send_as(const actor& from, const typed_actor<Sigs...>& to, Ts&&... xs) {
using token = using token =
detail::type_list< detail::type_list<
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Vs>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
token tk; token tk;
check_typed_input(to, tk); check_typed_input(to, tk);
send_as(from, message_priority::normal, send_as(from, message_priority::normal,
actor_cast<channel>(to), std::forward<Vs>(vs)...); actor_cast<channel>(to), std::forward<Ts>(xs)...);
} }
/** /**
* Anonymously sends `to` a message with priority `prio`. * Anonymously sends `to` a message with priority `prio`.
*/ */
template <class... Vs> template <class... Ts>
void anon_send(message_priority prio, const channel& to, Vs&&... vs) { void anon_send(message_priority prio, const channel& to, Ts&&... xs) {
send_as(invalid_actor, prio, to, std::forward<Vs>(vs)...); send_as(invalid_actor, prio, to, std::forward<Ts>(xs)...);
} }
/** /**
* Anonymously sends `to` a message. * Anonymously sends `to` a message.
*/ */
template <class... Vs> template <class... Ts>
void anon_send(const channel& to, Vs&&... vs) { void anon_send(const channel& to, Ts&&... xs) {
send_as(invalid_actor, message_priority::normal, to, std::forward<Vs>(vs)...); send_as(invalid_actor, message_priority::normal, to, std::forward<Ts>(xs)...);
} }
/** /**
* Anonymously sends `to` a message with priority `prio`. * Anonymously sends `to` a message with priority `prio`.
*/ */
template <class... Rs, class... Vs> template <class... Sigs, class... Ts>
void anon_send(message_priority prio, const typed_actor<Rs...>& to, void anon_send(message_priority prio, const typed_actor<Sigs...>& to,
Vs&&... vs) { Ts&&... xs) {
using token = using token =
detail::type_list< detail::type_list<
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Vs>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
token tk; token tk;
check_typed_input(to, tk); check_typed_input(to, tk);
anon_send(prio, actor_cast<channel>(to), std::forward<Vs>(vs)...); anon_send(prio, actor_cast<channel>(to), std::forward<Ts>(xs)...);
} }
/** /**
* Anonymously sends `to` a message. * Anonymously sends `to` a message.
*/ */
template <class... Rs, class... Vs> template <class... Sigs, class... Ts>
void anon_send(const typed_actor<Rs...>& to, Vs&&... vs) { void anon_send(const typed_actor<Sigs...>& to, Ts&&... xs) {
using token = using token =
detail::type_list< detail::type_list<
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Vs>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
token tk; token tk;
check_typed_input(to, tk); check_typed_input(to, tk);
anon_send(message_priority::normal, actor_cast<channel>(to), anon_send(message_priority::normal, actor_cast<channel>(to),
std::forward<Vs>(vs)...); std::forward<Ts>(xs)...);
} }
/** /**
......
...@@ -234,13 +234,13 @@ actor spawn_in_group(const group& grp, Ts&&... args) { ...@@ -234,13 +234,13 @@ actor spawn_in_group(const group& grp, Ts&&... args) {
/** /**
* Base class for strongly typed actors using a functor-based implementation. * Base class for strongly typed actors using a functor-based implementation.
*/ */
template <class... Rs> template <class... Sigs>
class functor_based_typed_actor : public typed_event_based_actor<Rs...> { class functor_based_typed_actor : public typed_event_based_actor<Sigs...> {
public: public:
/** /**
* Base class for actors using given interface. * Base class for actors using given interface.
*/ */
using base = typed_event_based_actor<Rs...>; using base = typed_event_based_actor<Sigs...>;
/** /**
* Pointer to the base class. * Pointer to the base class.
...@@ -339,14 +339,14 @@ class functor_based_typed_actor : public typed_event_based_actor<Rs...> { ...@@ -339,14 +339,14 @@ class functor_based_typed_actor : public typed_event_based_actor<Rs...> {
template <class Result, class FirstArg> template <class Result, class FirstArg>
struct infer_typed_actor_base; struct infer_typed_actor_base;
template <class... Rs, class FirstArg> template <class... Sigs, class FirstArg>
struct infer_typed_actor_base<typed_behavior<Rs...>, FirstArg> { struct infer_typed_actor_base<typed_behavior<Sigs...>, FirstArg> {
using type = functor_based_typed_actor<Rs...>; using type = functor_based_typed_actor<Sigs...>;
}; };
template <class... Rs> template <class... Sigs>
struct infer_typed_actor_base<void, typed_event_based_actor<Rs...>*> { struct infer_typed_actor_base<void, typed_event_based_actor<Sigs...>*> {
using type = functor_based_typed_actor<Rs...>; using type = functor_based_typed_actor<Sigs...>;
}; };
/** /**
......
...@@ -76,23 +76,23 @@ template <class TypedBehavior, class FirstArg> ...@@ -76,23 +76,23 @@ template <class TypedBehavior, class FirstArg>
struct infer_typed_actor_handle; struct infer_typed_actor_handle;
// infer actor type from result type if possible // infer actor type from result type if possible
template <class... Rs, class FirstArg> template <class... Sigs, class FirstArg>
struct infer_typed_actor_handle<typed_behavior<Rs...>, FirstArg> { struct infer_typed_actor_handle<typed_behavior<Sigs...>, FirstArg> {
using type = typed_actor<Rs...>; using type = typed_actor<Sigs...>;
}; };
// infer actor type from first argument if result type is void // infer actor type from first argument if result type is void
template <class... Rs> template <class... Sigs>
struct infer_typed_actor_handle<void, typed_event_based_actor<Rs...>*> { struct infer_typed_actor_handle<void, typed_event_based_actor<Sigs...>*> {
using type = typed_actor<Rs...>; using type = typed_actor<Sigs...>;
}; };
template <class SignatureList> template <class SignatureList>
struct actor_handle_from_signature_list; struct actor_handle_from_signature_list;
template <class... Rs> template <class... Sigs>
struct actor_handle_from_signature_list<detail::type_list<Rs...>> { struct actor_handle_from_signature_list<detail::type_list<Sigs...>> {
using type = typed_actor<Rs...>; using type = typed_actor<Sigs...>;
}; };
template <spawn_options Os, typename BeforeLaunch, typename F, class... Ts> template <spawn_options Os, typename BeforeLaunch, typename F, class... Ts>
......
...@@ -36,18 +36,19 @@ class local_actor; ...@@ -36,18 +36,19 @@ class local_actor;
struct invalid_actor_addr_t; struct invalid_actor_addr_t;
template <class... Rs> template <class... Sigs>
class typed_event_based_actor; class typed_event_based_actor;
/** /**
* Identifies a strongly typed actor. * Identifies a strongly typed actor.
* @tparam Rs Interface as `replies_to<...>::with<...>` parameter pack. * @tparam Sigs Signature of this actor as `replies_to<...>::with<...>`
* parameter pack.
*/ */
template <class... Rs> template <class... Sigs>
class typed_actor class typed_actor
: detail::comparable<typed_actor<Rs...>>, : detail::comparable<typed_actor<Sigs...>>,
detail::comparable<typed_actor<Rs...>, actor_addr>, detail::comparable<typed_actor<Sigs...>, actor_addr>,
detail::comparable<typed_actor<Rs...>, invalid_actor_addr_t> { detail::comparable<typed_actor<Sigs...>, invalid_actor_addr_t> {
friend class local_actor; friend class local_actor;
...@@ -63,24 +64,24 @@ class typed_actor ...@@ -63,24 +64,24 @@ class typed_actor
template <class... Es> template <class... Es>
struct extend { struct extend {
using type = typed_actor<Rs..., 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.
*/ */
using behavior_type = typed_behavior<Rs...>; using behavior_type = typed_behavior<Sigs...>;
/** /**
* Identifies pointers to instances of this kind of actor. * Identifies pointers to instances of this kind of actor.
*/ */
using pointer = typed_event_based_actor<Rs...>*; using pointer = typed_event_based_actor<Sigs...>*;
/** /**
* Identifies the base class for this kind of actor. * Identifies the base class for this kind of actor.
*/ */
using base = typed_event_based_actor<Rs...>; using base = typed_event_based_actor<Sigs...>;
typed_actor() = default; typed_actor() = default;
typed_actor(typed_actor&&) = default; typed_actor(typed_actor&&) = default;
...@@ -88,13 +89,13 @@ class typed_actor ...@@ -88,13 +89,13 @@ class typed_actor
typed_actor& operator=(typed_actor&&) = default; typed_actor& operator=(typed_actor&&) = default;
typed_actor& operator=(const typed_actor&) = default; typed_actor& operator=(const typed_actor&) = default;
template <class... OtherRs> template <class... OtherSigs>
typed_actor(const typed_actor<OtherRs...>& other) { typed_actor(const typed_actor<OtherSigs...>& other) {
set(std::move(other)); set(std::move(other));
} }
template <class... OtherRs> template <class... OtherSigs>
typed_actor& operator=(const typed_actor<OtherRs...>& other) { typed_actor& operator=(const typed_actor<OtherSigs...>& other) {
set(std::move(other)); set(std::move(other));
return *this; return *this;
} }
...@@ -132,7 +133,7 @@ class typed_actor ...@@ -132,7 +133,7 @@ class typed_actor
} }
static std::set<std::string> message_types() { static std::set<std::string> message_types() {
return {Rs::static_type_name()...}; return {Sigs::static_type_name()...};
} }
explicit operator bool() const { return static_cast<bool>(m_ptr); } explicit operator bool() const { return static_cast<bool>(m_ptr); }
...@@ -151,15 +152,15 @@ class typed_actor ...@@ -151,15 +152,15 @@ class typed_actor
"'this' must be a strict subset of 'other'"); "'this' must be a strict subset of 'other'");
} }
template <class... OtherRs> template <class... OtherSigs>
inline void set(const typed_actor<OtherRs...>& other) { inline void set(const typed_actor<OtherSigs...>& other) {
check_signatures<detail::type_list<Rs...>, detail::type_list<OtherRs...>>(); check_signatures<detail::type_list<Sigs...>, detail::type_list<OtherSigs...>>();
m_ptr = other.m_ptr; m_ptr = other.m_ptr;
} }
template <class Impl> template <class Impl>
inline void set(intrusive_ptr<Impl>& other) { inline void set(intrusive_ptr<Impl>& other) {
check_signatures<detail::type_list<Rs...>, typename Impl::signatures>(); check_signatures<detail::type_list<Sigs...>, typename Impl::signatures>();
m_ptr = std::move(other); m_ptr = std::move(other);
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
namespace caf { namespace caf {
template <class... Rs> template <class... Sigs>
class functor_based_typed_actor; class functor_based_typed_actor;
namespace detail { namespace detail {
...@@ -57,18 +57,6 @@ struct collapse_replies_to_statement<List, none_t> { ...@@ -57,18 +57,6 @@ struct collapse_replies_to_statement<List, none_t> {
using type = List; using type = List;
}; };
/*
template <class List>
struct unbox_typed_continue_helper {
using type = List;
};
template <class List>
struct unbox_typed_continue_helper<typed_continue_helper<List>> {
using type = List;
};
*/
template <class Input, class RepliesToWith> template <class Input, class RepliesToWith>
struct same_input : std::is_same<Input, typename RepliesToWith::input_types> {}; struct same_input : std::is_same<Input, typename RepliesToWith::input_types> {};
...@@ -168,7 +156,7 @@ void static_check_typed_behavior_input() { ...@@ -168,7 +156,7 @@ void static_check_typed_behavior_input() {
} // namespace detail } // namespace detail
template <class... Rs> template <class... Sigs>
class typed_actor; class typed_actor;
namespace mixin { namespace mixin {
...@@ -176,10 +164,10 @@ template <class, class, class> ...@@ -176,10 +164,10 @@ template <class, class, class>
class behavior_stack_based_impl; class behavior_stack_based_impl;
} }
template <class... Rs> template <class... Sigs>
class typed_behavior { class typed_behavior {
public: public:
template <class... OtherRs> template <class... OtherSigs>
friend class typed_actor; friend class typed_actor;
template <class, class, class> template <class, class, class>
...@@ -193,11 +181,11 @@ class typed_behavior { ...@@ -193,11 +181,11 @@ class typed_behavior {
typed_behavior& operator=(typed_behavior&&) = default; typed_behavior& operator=(typed_behavior&&) = default;
typed_behavior& operator=(const typed_behavior&) = default; typed_behavior& operator=(const typed_behavior&) = default;
using signatures = detail::type_list<Rs...>; using signatures = detail::type_list<Sigs...>;
template <class... Vs> template <class... Ts>
typed_behavior(Vs... vs) { typed_behavior(Ts... xs) {
set(detail::make_behavior(vs...)); set(detail::make_behavior(xs...));
} }
explicit operator bool() const { explicit operator bool() const {
......
...@@ -37,18 +37,18 @@ namespace caf { ...@@ -37,18 +37,18 @@ namespace caf {
* `blocking_api` flag. * `blocking_api` flag.
* @extends mailbox_based_actor * @extends mailbox_based_actor
*/ */
template <class... Rs> template <class... Sigs>
class typed_event_based_actor : public class typed_event_based_actor : public
extend<mailbox_based_actor, typed_event_based_actor<Rs...>>::template extend<mailbox_based_actor, typed_event_based_actor<Sigs...>>::template
with<mixin::behavior_stack_based<typed_behavior<Rs...>>::template impl, with<mixin::behavior_stack_based<typed_behavior<Sigs...>>::template impl,
mixin::sync_sender<nonblocking_response_handle_tag>::template impl> { mixin::sync_sender<nonblocking_response_handle_tag>::template impl> {
public: public:
using signatures = detail::type_list<Rs...>; using signatures = detail::type_list<Sigs...>;
using behavior_type = typed_behavior<Rs...>; using behavior_type = typed_behavior<Sigs...>;
std::set<std::string> message_types() const override { std::set<std::string> message_types() const override {
return {Rs::static_type_name()...}; return {Sigs::static_type_name()...};
} }
protected: protected:
......
...@@ -68,10 +68,10 @@ inline void deliver(delayed_msg& dm) { ...@@ -68,10 +68,10 @@ inline void deliver(delayed_msg& dm) {
} }
template <class Map, class... Ts> template <class Map, class... Ts>
inline void insert_dmsg(Map& storage, const duration& d, Ts&&... vs) { inline void insert_dmsg(Map& storage, const duration& d, Ts&&... xs) {
auto tout = hrc::now(); auto tout = hrc::now();
tout += d; tout += d;
delayed_msg dmsg{std::forward<Ts>(vs)...}; delayed_msg dmsg{std::forward<Ts>(xs)...};
storage.insert(std::make_pair(std::move(tout), std::move(dmsg))); storage.insert(std::make_pair(std::move(tout), std::move(dmsg)));
} }
......
...@@ -226,9 +226,9 @@ class broker : public extend<local_actor>:: ...@@ -226,9 +226,9 @@ class broker : public extend<local_actor>::
/** @cond PRIVATE */ /** @cond PRIVATE */
template <class F, class... Ts> template <class F, class... Ts>
actor fork(F fun, connection_handle hdl, Ts&&... vs) { actor fork(F fun, connection_handle hdl, Ts&&... xs) {
// provoke compile-time errors early // provoke compile-time errors early
using fun_res = decltype(fun(this, hdl, std::forward<Ts>(vs)...)); using fun_res = decltype(fun(this, hdl, std::forward<Ts>(xs)...));
// prevent warning about unused local type // prevent warning about unused local type
static_assert(std::is_same<fun_res, fun_res>::value, static_assert(std::is_same<fun_res, fun_res>::value,
"your compiler is lying to you"); "your compiler is lying to you");
...@@ -245,7 +245,7 @@ class broker : public extend<local_actor>:: ...@@ -245,7 +245,7 @@ class broker : public extend<local_actor>::
forked->m_scribes.insert( forked->m_scribes.insert(
std::make_pair(sptr->hdl(), sptr)); std::make_pair(sptr->hdl(), sptr));
}, },
fun, hdl, std::forward<Ts>(vs)...); fun, hdl, std::forward<Ts>(xs)...);
} }
inline void add_scribe(const scribe_pointer& ptr) { inline void add_scribe(const scribe_pointer& ptr) {
...@@ -393,7 +393,7 @@ class broker::functor_based : public extend<broker>:: ...@@ -393,7 +393,7 @@ class broker::functor_based : public extend<broker>::
using super = combined_type; using super = combined_type;
template <class... Ts> template <class... Ts>
functor_based(Ts&&... vs) : super(std::forward<Ts>(vs)...) { functor_based(Ts&&... xs) : super(std::forward<Ts>(xs)...) {
// nop // nop
} }
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
// poll vs epoll backend // poll xs epoll backend
#if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer #if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer
# define CAF_POLL_MULTIPLEXER # define CAF_POLL_MULTIPLEXER
# ifndef CAF_WINDOWS # ifndef CAF_WINDOWS
...@@ -105,7 +105,7 @@ namespace network { ...@@ -105,7 +105,7 @@ namespace network {
constexpr int ec_interrupted_syscall = EINTR; constexpr int ec_interrupted_syscall = EINTR;
#endif #endif
// poll vs epoll backend // poll xs epoll backend
#if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer #if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer
# ifdef CAF_WINDOWS # ifdef CAF_WINDOWS
// From the MSDN: If the POLLPRI flag is set on a socket for the Microsoft // From the MSDN: If the POLLPRI flag is set on a socket for the Microsoft
......
...@@ -53,8 +53,8 @@ inline uint16_t publish(caf::actor whom, uint16_t port, ...@@ -53,8 +53,8 @@ inline uint16_t publish(caf::actor whom, uint16_t port,
/** /**
* @copydoc publish(actor,uint16_t,const char*) * @copydoc publish(actor,uint16_t,const char*)
*/ */
template <class... Rs> template <class... Sigs>
uint16_t typed_publish(typed_actor<Rs...> whom, uint16_t port, uint16_t typed_publish(typed_actor<Sigs...> whom, uint16_t port,
const char* in = nullptr, bool reuse_addr = false) { const char* in = nullptr, bool reuse_addr = false) {
if (!whom) { if (!whom) {
return 0; return 0;
......
...@@ -34,20 +34,6 @@ namespace io { ...@@ -34,20 +34,6 @@ namespace io {
abstract_actor_ptr remote_actor_impl(std::set<std::string> ifs, abstract_actor_ptr remote_actor_impl(std::set<std::string> ifs,
const std::string& host, uint16_t port); const std::string& host, uint16_t port);
template <class List>
struct typed_remote_actor_helper;
template <template <class...> class List, class... Ts>
struct typed_remote_actor_helper<List<Ts...>> {
using return_type = typed_actor<Ts...>;
template <class... Vs>
return_type operator()(Vs&&... vs) {
auto iface = return_type::message_types();
auto tmp = remote_actor_impl(std::move(iface), std::forward<Vs>(vs)...);
return actor_cast<return_type>(tmp);
}
};
/** /**
* Establish a new connection to the actor at `host` on given `port`. * Establish a new connection to the actor at `host` on given `port`.
* @param host Valid hostname or IP address. * @param host Valid hostname or IP address.
...@@ -71,11 +57,11 @@ inline actor remote_actor(const std::string& host, uint16_t port) { ...@@ -71,11 +57,11 @@ inline actor remote_actor(const std::string& host, uint16_t port) {
* @throws network_error Thrown on connection error or when connecting * @throws network_error Thrown on connection error or when connecting
* to an untyped otherwise unexpected actor. * to an untyped otherwise unexpected actor.
*/ */
template <class List> template <class ActorHandle>
typename typed_remote_actor_helper<List>::return_type ActorHandle typed_remote_actor(const std::string& host, uint16_t port) {
typed_remote_actor(const std::string& host, uint16_t port) { auto iface = ActorHandle::message_types();
typed_remote_actor_helper<List> f; return actor_cast<ActorHandle>(remote_actor_impl(std::move(iface),
return f(host, port); host, port));
} }
} // namespace io } // namespace io
......
...@@ -38,8 +38,8 @@ namespace io { ...@@ -38,8 +38,8 @@ namespace io {
*/ */
template <spawn_options Os = no_spawn_options, template <spawn_options Os = no_spawn_options,
typename F = std::function<void(broker*)>, class... Ts> typename F = std::function<void(broker*)>, class... Ts>
actor spawn_io(F fun, Ts&&... vs) { actor spawn_io(F fun, Ts&&... xs) {
return spawn<broker::functor_based>(std::move(fun), std::forward<Ts>(vs)...); return spawn<broker::functor_based>(std::move(fun), std::forward<Ts>(xs)...);
} }
/** /**
......
...@@ -247,7 +247,7 @@ namespace network { ...@@ -247,7 +247,7 @@ namespace network {
#endif #endif
/****************************************************************************** /******************************************************************************
* epoll() vs. poll() * * epoll() xs. poll() *
******************************************************************************/ ******************************************************************************/
#ifdef CAF_EPOLL_MULTIPLEXER #ifdef CAF_EPOLL_MULTIPLEXER
......
...@@ -276,15 +276,15 @@ class middleman_actor_impl : public middleman_actor_base::base { ...@@ -276,15 +276,15 @@ class middleman_actor_impl : public middleman_actor_base::base {
return result; return result;
} }
template <class T, class... Vs> template <class T, class... Ts>
void handle_ok(map_type& storage, int64_t request_id, Vs&&... vs) { void handle_ok(map_type& storage, int64_t request_id, Ts&&... xs) {
CAF_LOG_TRACE(CAF_ARG(request_id)); CAF_LOG_TRACE(CAF_ARG(request_id));
auto i = storage.find(request_id); auto i = storage.find(request_id);
if (i == storage.end()) { if (i == storage.end()) {
CAF_LOG_ERROR("request id not found: " << request_id); CAF_LOG_ERROR("request id not found: " << request_id);
return; return;
} }
i->second.deliver(T{ok_atom::value, std::forward<Vs>(vs)...}.value); i->second.deliver(T{ok_atom::value, std::forward<Ts>(xs)...}.value);
storage.erase(i); storage.erase(i);
} }
......
...@@ -45,8 +45,8 @@ void fill_mb(message_builder&) { ...@@ -45,8 +45,8 @@ void fill_mb(message_builder&) {
} }
template <class T, class... Ts> template <class T, class... Ts>
void fill_mb(message_builder& mb, const T& v, const Ts&... vs) { void fill_mb(message_builder& mb, const T& x, const Ts&... xs) {
fill_mb(mb.append(v), vs...); fill_mb(mb.append(x), xs...);
} }
template <class... Ts> template <class... Ts>
......
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