Commit c868d8c9 authored by neverlord's avatar neverlord

fixed spawn(..., self, ...)

parent 0f85ceb4
...@@ -62,7 +62,13 @@ class ftor_behavior<true, true, F, Args...> : public scheduled_actor ...@@ -62,7 +62,13 @@ class ftor_behavior<true, true, F, Args...> : public scheduled_actor
static_assert(sizeof...(Args) > 0, "sizeof...(Args) == 0"); static_assert(sizeof...(Args) > 0, "sizeof...(Args) == 0");
F m_fun; F m_fun;
tdata<Args...> m_args;
typedef typename tdata_from_type_list<
typename util::type_list_apply<util::type_list<Args...>,
implicit_conversions>::type>::type
tdata_type;
tdata_type m_args;
public: public:
...@@ -95,7 +101,13 @@ class ftor_behavior<false, true, F, Args...> : public scheduled_actor ...@@ -95,7 +101,13 @@ class ftor_behavior<false, true, F, Args...> : public scheduled_actor
static_assert(sizeof...(Args) > 0, "sizeof...(Args) == 0"); static_assert(sizeof...(Args) > 0, "sizeof...(Args) == 0");
F m_fun; F m_fun;
tdata<Args...> m_args;
typedef typename tdata_from_type_list<
typename util::type_list_apply<util::type_list<Args...>,
implicit_conversions>::type>::type
tdata_type;
tdata_type m_args;
public: public:
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include "cppa/self.hpp"
#include "cppa/actor.hpp" #include "cppa/actor.hpp"
#include "cppa/util/is_array_of.hpp" #include "cppa/util/is_array_of.hpp"
...@@ -67,8 +68,11 @@ struct implicit_conversions ...@@ -67,8 +68,11 @@ struct implicit_conversions
typedef typename util::replace_type<subtype3, actor_ptr, typedef typename util::replace_type<subtype3, actor_ptr,
std::is_same<actor*,T>, std::is_same<actor*,T>,
std::is_same<local_actor*,T>>::type std::is_same<local_actor*,T>,
std::is_same<self_type,T>,
std::is_same<self_type,T>>::type
type; type;
}; };
} } // namespace cppa::detail } } // namespace cppa::detail
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#define SELF_HPP #define SELF_HPP
#include "cppa/actor.hpp" #include "cppa/actor.hpp"
#include "cppa/local_actor.hpp"
#include "cppa/intrusive_ptr.hpp" #include "cppa/intrusive_ptr.hpp"
namespace cppa { namespace cppa {
...@@ -47,6 +46,8 @@ extern local_actor* self; ...@@ -47,6 +46,8 @@ extern local_actor* self;
#else #else
class local_actor;
// convertible<...> enables "actor_ptr this_actor = self;" // convertible<...> enables "actor_ptr this_actor = self;"
class self_type : public convertible<self_type, actor*> class self_type : public convertible<self_type, actor*>
{ {
...@@ -57,6 +58,8 @@ class self_type : public convertible<self_type, actor*> ...@@ -57,6 +58,8 @@ class self_type : public convertible<self_type, actor*>
static local_actor* get_impl(); static local_actor* get_impl();
static actor* convert_impl();
self_type(self_type const&) = delete; self_type(self_type const&) = delete;
self_type& operator=(self_type const&) = delete; self_type& operator=(self_type const&) = delete;
...@@ -65,9 +68,9 @@ class self_type : public convertible<self_type, actor*> ...@@ -65,9 +68,9 @@ class self_type : public convertible<self_type, actor*>
constexpr self_type() { } constexpr self_type() { }
// "inherited" from convertible<...> // "inherited" from convertible<...>
inline local_actor* do_convert() const inline actor* do_convert() const
{ {
return get_impl(); return convert_impl();
} }
// allow "self" wherever an local_actor or actor pointer is expected // allow "self" wherever an local_actor or actor pointer is expected
......
...@@ -80,6 +80,11 @@ local_actor* self_type::get_impl() ...@@ -80,6 +80,11 @@ local_actor* self_type::get_impl()
return result; return result;
} }
actor* self_type::convert_impl()
{
return get_impl();
}
local_actor* self_type::get_unchecked_impl() local_actor* self_type::get_unchecked_impl()
{ {
return t_this_context.get(); return t_this_context.get();
......
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