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
5a624bf1
Commit
5a624bf1
authored
Dec 15, 2015
by
ufownl
Committed by
Dominik Charousset
Mar 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `extend_with` of `typed_actor`
parent
555adc90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
libcaf_core/caf/detail/typed_actor_util.hpp
libcaf_core/caf/detail/typed_actor_util.hpp
+11
-0
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+6
-0
libcaf_core/test/typed_spawn.cpp
libcaf_core/test/typed_spawn.cpp
+16
-0
No files found.
libcaf_core/caf/detail/typed_actor_util.hpp
View file @
5a624bf1
...
...
@@ -30,6 +30,9 @@
namespace
caf
{
// forward declarations
template
<
class
...
Ts
>
class
typed_actor
;
template
<
class
R
>
class
typed_continue_helper
;
...
...
@@ -267,6 +270,14 @@ struct sender_signature_checker<OrigSigs, DestSigs, detail::type_list<>> {
static
void
check
()
{}
};
template
<
class
T
,
class
...
Ts
>
struct
extend_with_helper
;
template
<
class
...
Ts
,
class
...
Es
>
struct
extend_with_helper
<
typed_actor
<
Es
...
>
,
Ts
...
>
{
using
type
=
typed_actor
<
Ts
...,
Es
...
>
;
};
}
// namespace detail
}
// namespace caf
...
...
libcaf_core/caf/typed_actor.hpp
View file @
5a624bf1
...
...
@@ -76,6 +76,12 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
template
<
class
...
Es
>
using
extend
=
typed_actor
<
Sigs
...,
Es
...
>
;
/// Creates a new `typed_actor` type by extending this one with another
/// `typed_actor`.
template
<
class
T
>
using
extend_with
=
typename
detail
::
extend_with_helper
<
T
,
Sigs
...
>::
type
;
/// Identifies the behavior type actors of this kind use
/// for their behavior stack.
using
behavior_type
=
typed_behavior
<
Sigs
...
>
;
...
...
libcaf_core/test/typed_spawn.cpp
View file @
5a624bf1
...
...
@@ -48,6 +48,22 @@ static_assert(std::is_convertible<dummy2, dummy1>::value,
static_assert
(
!
std
::
is_convertible
<
dummy1
,
dummy2
>::
value
,
"handle is assignable to broader definition"
);
using
dummy3
=
typed_actor
<
reacts_to
<
float
,
int
>>
;
using
dummy4
=
typed_actor
<
replies_to
<
int
>::
with
<
double
>>
;
using
dummy5
=
dummy4
::
extend_with
<
dummy3
>
;
static_assert
(
std
::
is_convertible
<
dummy5
,
dummy3
>::
value
,
"handle not assignable to narrower definition"
);
static_assert
(
std
::
is_convertible
<
dummy5
,
dummy4
>::
value
,
"handle not assignable to narrower definition"
);
static_assert
(
!
std
::
is_convertible
<
dummy3
,
dummy5
>::
value
,
"handle is assignable to broader definition"
);
static_assert
(
!
std
::
is_convertible
<
dummy4
,
dummy5
>::
value
,
"handle is assignable to broader definition"
);
/******************************************************************************
* simple request/response test *
******************************************************************************/
...
...
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