Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
721ee285
Commit
721ee285
authored
Sep 09, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix initialization of typed handles from this
parent
5ca71fab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
14 deletions
+40
-14
libcaf_core/caf/detail/implicit_conversions.hpp
libcaf_core/caf/detail/implicit_conversions.hpp
+30
-8
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+10
-6
No files found.
libcaf_core/caf/detail/implicit_conversions.hpp
View file @
721ee285
...
...
@@ -24,11 +24,40 @@
#include <type_traits>
#include "caf/fwd.hpp"
#include "caf/actor_marker.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"
namespace
caf
{
namespace
detail
{
template
<
class
T
,
bool
IsDyn
=
std
::
is_base_of
<
dynamically_typed_actor_base
,
T
>
::
value
,
bool
IsStat
=
std
::
is_base_of
<
statically_typed_actor_base
,
T
>::
value
>
struct
implicit_actor_conversions
{
using
type
=
T
;
};
template
<
class
T
>
struct
implicit_actor_conversions
<
T
,
true
,
false
>
{
using
type
=
actor
;
};
template
<
class
T
>
struct
implicit_actor_conversions
<
T
,
false
,
true
>
{
using
type
=
typename
detail
::
tl_apply
<
typename
T
::
signatures
,
typed_actor
>::
type
;
};
template
<
>
struct
implicit_actor_conversions
<
actor_control_block
,
false
,
false
>
{
using
type
=
strong_actor_ptr
;
};
template
<
class
T
>
struct
implicit_conversions
{
using
type
=
...
...
@@ -40,14 +69,7 @@ struct implicit_conversions {
};
template
<
class
T
>
struct
implicit_conversions
<
T
*>
{
using
type
=
typename
std
::
conditional
<
std
::
is_base_of
<
abstract_actor
,
T
>::
value
,
actor
,
T
*
>::
type
;
};
struct
implicit_conversions
<
T
*>
:
implicit_actor_conversions
<
T
>
{};
template
<
>
struct
implicit_conversions
<
char
*>
{
...
...
libcaf_core/caf/typed_actor.hpp
View file @
721ee285
...
...
@@ -139,17 +139,21 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
signatures
,
detail
::
type_list
<
Ts
...
>
>::
value
,
"Cannot assign in
valid
handle"
);
"Cannot assign in
compatible
handle"
);
}
// allow `handle_type{this}` for typed actors
template
<
class
...
Ts
>
typed_actor
(
typed_actor
<
Ts
...
>*
ptr
)
:
ptr_
(
ptr
->
ctrl
())
{
template
<
class
T
>
typed_actor
(
T
*
ptr
,
typename
std
::
enable_if
<
std
::
is_base_of
<
statically_typed_actor_base
,
T
>::
value
>::
type
*
=
0
)
:
ptr_
(
ptr
->
ctrl
())
{
static_assert
(
detail
::
tl_subset_of
<
signatures
,
detail
::
type_list
<
Ts
...
>
typename
T
::
signatures
>::
value
,
"Cannot assign
invalid handl
e"
);
"Cannot assign
T* to incompatible handle typ
e"
);
CAF_ASSERT
(
ptr
!=
nullptr
);
}
...
...
@@ -159,7 +163,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
signatures
,
detail
::
type_list
<
Ts
...
>
>::
value
,
"Cannot assign in
valid
handle"
);
"Cannot assign in
compatible
handle"
);
ptr_
=
other
.
ptr_
;
return
*
this
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment