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
cd03a6b0
Commit
cd03a6b0
authored
Jan 20, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up C++17 ToDo
parent
7b10813f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
26 deletions
+10
-26
libcaf_core/caf/policy/select_all.hpp
libcaf_core/caf/policy/select_all.hpp
+10
-26
No files found.
libcaf_core/caf/policy/select_all.hpp
View file @
cd03a6b0
...
...
@@ -105,29 +105,6 @@ struct select_select_all_helper<F, detail::type_list<std::vector<T>>> {
template
<
class
F
>
using
select_all_helper_t
=
typename
select_select_all_helper
<
F
>::
type
;
// TODO: Replace with a lambda when switching to C++17 (move g into lambda).
template
<
class
G
>
class
select_all_error_handler
{
public:
template
<
class
Fun
>
select_all_error_handler
(
Fun
&&
fun
,
std
::
shared_ptr
<
size_t
>
pending
)
:
handler
(
std
::
forward
<
Fun
>
(
fun
)),
pending
(
std
::
move
(
pending
))
{
// nop
}
void
operator
()(
error
&
err
)
{
CAF_LOG_TRACE
(
CAF_ARG2
(
"pending"
,
*
pending
));
if
(
*
pending
>
0
)
{
*
pending
=
0
;
handler
(
err
);
}
}
private:
G
handler
;
std
::
shared_ptr
<
size_t
>
pending
;
};
}
// namespace caf::detail
namespace
caf
::
policy
{
...
...
@@ -203,12 +180,19 @@ private:
behavior
make_behavior
(
F
&&
f
,
OnError
&&
g
)
const
{
using
namespace
detail
;
using
helper_type
=
select_all_helper_t
<
decay_t
<
F
>>
;
using
error_handler_type
=
select_all_error_handler
<
decay_t
<
OnError
>>
;
helper_type
helper
{
ids_
.
size
(),
std
::
move
(
f
)};
error_handler_type
err_helper
{
std
::
forward
<
OnError
>
(
g
),
helper
.
pending
};
auto
pending
=
helper
.
pending
;
auto
error_handler
=
[
pending
{
std
::
move
(
pending
)},
g
{
std
::
forward
<
OnError
>
(
g
)}](
error
&
err
)
mutable
{
CAF_LOG_TRACE
(
CAF_ARG2
(
"pending"
,
*
pending
));
if
(
*
pending
>
0
)
{
*
pending
=
0
;
g
(
err
);
}
};
return
{
std
::
move
(
helper
),
std
::
move
(
err
_help
er
),
std
::
move
(
err
or_handl
er
),
};
}
...
...
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