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
99556335
Commit
99556335
authored
Jul 30, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide `std::hash` for typed actors
parent
f4a65655
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+17
-4
No files found.
libcaf_core/caf/typed_actor.hpp
View file @
99556335
...
...
@@ -60,6 +60,8 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
detail
::
comparable
<
typed_actor
<
Sigs
...
>
,
invalid_actor_addr_t
>
{
public:
static_assert
(
sizeof
...(
Sigs
)
>
0
,
"Empty typed actor handle"
);
// grant access to private ctor
friend
class
local_actor
;
...
...
@@ -169,6 +171,11 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
ptr_
.
swap
(
other
.
ptr_
);
}
/// Returns the interface definition for this actor handle.
static
std
::
set
<
std
::
string
>
message_types
()
{
return
std
::
set
<
std
::
string
>
{
Sigs
::
static_type_name
()...};
}
/// @cond PRIVATE
abstract_actor
*
operator
->
()
const
noexcept
{
...
...
@@ -191,10 +198,6 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
return
ptr_
?
1
:
0
;
}
static
std
::
set
<
std
::
string
>
message_types
()
{
return
{
Sigs
::
static_type_name
()...};
}
/// @endcond
private:
...
...
@@ -211,4 +214,14 @@ private:
}
// namespace caf
// allow typed_actor to be used in hash maps
namespace
std
{
template
<
class
...
Sigs
>
struct
hash
<
caf
::
typed_actor
<
Sigs
...
>>
{
size_t
operator
()(
const
caf
::
typed_actor
<
Sigs
...
>&
ref
)
const
{
return
ref
?
static_cast
<
size_t
>
(
ref
->
id
())
:
0
;
}
};
}
// namespace std
#endif // CAF_TYPED_ACTOR_HPP
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