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
5b11dc0f
Commit
5b11dc0f
authored
Aug 29, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added invoke() member function to be able to fetch result of invoked function
parent
20666779
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
cppa/detail/projection.hpp
cppa/detail/projection.hpp
+42
-0
No files found.
cppa/detail/projection.hpp
View file @
5b11dc0f
...
...
@@ -58,6 +58,23 @@ struct projection_helper {
}
};
template
<
class
PartialFun
>
struct
result_fetching_projection_helper
{
typedef
typename
PartialFun
::
result_type
result_type
;
const
PartialFun
&
fun
;
result_type
&
result
;
result_fetching_projection_helper
(
const
PartialFun
&
pfun
,
result_type
&
res
)
:
fun
(
pfun
),
result
(
res
)
{
}
template
<
typename
...
Args
>
bool
operator
()(
Args
&&
...
args
)
const
{
if
(
fun
.
defined_at
(
std
::
forward
<
Args
>
(
args
)...))
{
result
=
fun
(
std
::
forward
<
Args
>
(
args
)...);
return
true
;
}
return
false
;
}
};
/**
* @brief Projection implemented by a set of functors.
*/
...
...
@@ -103,6 +120,31 @@ class projection {
return
false
;
}
template
<
class
PartialFun
>
bool
invoke
(
PartialFun
&
fun
,
typename
PartialFun
::
result_type
&
result
,
Args
...
args
)
const
{
typedef
typename
PartialFun
::
result_type
result_type
;
typedef
typename
util
::
tl_zip
<
typename
util
::
tl_map
<
ProjectionFuns
,
util
::
get_result_type
,
util
::
rm_option
>::
type
,
typename
util
::
tl_map
<
util
::
type_list
<
Args
...
>
,
mutable_gref_wrapped
>::
type
,
util
::
left_or_right
>::
type
collected_args
;
typename
tdata_from_type_list
<
collected_args
>::
type
pargs
;
if
(
collect
(
pargs
,
m_funs
,
std
::
forward
<
Args
>
(
args
)...))
{
result_fetching_projection_helper
<
PartialFun
>
helper
{
fun
,
result
};
return
util
::
unchecked_apply_tuple
<
bool
>
(
helper
,
pargs
);
}
return
false
;
}
private:
template
<
typename
Storage
,
typename
T
>
...
...
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