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
87646ff2
Commit
87646ff2
authored
Dec 15, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #386 from ufownl/topic/add_extend_with
Add `extend_with` for `typed_actor`
parents
361dfa80
be26b569
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 @
87646ff2
...
@@ -30,6 +30,9 @@
...
@@ -30,6 +30,9 @@
namespace
caf
{
// forward declarations
namespace
caf
{
// forward declarations
template
<
class
...
Ts
>
class
typed_actor
;
template
<
class
R
>
template
<
class
R
>
class
typed_continue_helper
;
class
typed_continue_helper
;
...
@@ -267,6 +270,14 @@ struct sender_signature_checker<OrigSigs, DestSigs, detail::type_list<>> {
...
@@ -267,6 +270,14 @@ struct sender_signature_checker<OrigSigs, DestSigs, detail::type_list<>> {
static
void
check
()
{}
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 detail
}
// namespace caf
}
// namespace caf
...
...
libcaf_core/caf/typed_actor.hpp
View file @
87646ff2
...
@@ -76,6 +76,12 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
...
@@ -76,6 +76,12 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
template
<
class
...
Es
>
template
<
class
...
Es
>
using
extend
=
typed_actor
<
Sigs
...,
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
/// Identifies the behavior type actors of this kind use
/// for their behavior stack.
/// for their behavior stack.
using
behavior_type
=
typed_behavior
<
Sigs
...
>
;
using
behavior_type
=
typed_behavior
<
Sigs
...
>
;
...
...
libcaf_core/test/typed_spawn.cpp
View file @
87646ff2
...
@@ -48,6 +48,22 @@ static_assert(std::is_convertible<dummy2, dummy1>::value,
...
@@ -48,6 +48,22 @@ static_assert(std::is_convertible<dummy2, dummy1>::value,
static_assert
(
!
std
::
is_convertible
<
dummy1
,
dummy2
>::
value
,
static_assert
(
!
std
::
is_convertible
<
dummy1
,
dummy2
>::
value
,
"handle is assignable to broader definition"
);
"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 *
* 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