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
3301e1f0
Commit
3301e1f0
authored
Aug 03, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of containers with user-defined types
parent
16f48056
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
libcaf_core/caf/data_processor.hpp
libcaf_core/caf/data_processor.hpp
+22
-22
No files found.
libcaf_core/caf/data_processor.hpp
View file @
3301e1f0
...
...
@@ -240,12 +240,10 @@ public:
template
<
class
T
>
error
consume_range
(
T
&
xs
)
{
for
(
auto
&
x
:
xs
)
{
using
value_type
=
typename
std
::
remove_const
<
typename
std
::
remove_reference
<
decltype
(
x
)
>::
type
>::
type
;
auto
e
=
apply
(
const_cast
<
value_type
&>
(
x
));
if
(
e
)
return
e
;
using
value_type
=
typename
std
::
remove_reference
<
decltype
(
x
)
>::
type
;
using
mutable_type
=
typename
std
::
remove_const
<
value_type
>::
type
;
if
(
auto
err
=
apply_derived
(
const_cast
<
mutable_type
&>
(
x
)))
return
err
;
}
return
none
;
}
...
...
@@ -254,9 +252,8 @@ public:
template
<
class
U
,
class
T
>
error
consume_range_c
(
T
&
xs
)
{
for
(
U
x
:
xs
)
{
auto
e
=
apply
(
x
);
if
(
e
)
return
e
;
if
(
auto
err
=
apply_derived
(
x
))
return
err
;
}
return
none
;
}
...
...
@@ -267,8 +264,7 @@ public:
auto
insert_iter
=
std
::
inserter
(
xs
,
xs
.
end
());
for
(
size_t
i
=
0
;
i
<
num_elements
;
++
i
)
{
typename
std
::
remove_const
<
typename
T
::
value_type
>::
type
x
;
auto
err
=
apply
(
x
);
if
(
err
)
if
(
auto
err
=
apply_derived
(
x
))
return
err
;
*
insert_iter
++
=
std
::
move
(
x
);
}
...
...
@@ -282,8 +278,7 @@ public:
auto
insert_iter
=
std
::
inserter
(
xs
,
xs
.
end
());
for
(
size_t
i
=
0
;
i
<
num_elements
;
++
i
)
{
U
x
;
auto
err
=
apply
(
x
);
if
(
err
)
if
(
auto
err
=
apply_derived
(
x
))
return
err
;
*
insert_iter
++
=
std
::
move
(
x
);
}
...
...
@@ -380,8 +375,8 @@ public:
using
t0
=
typename
std
::
remove_const
<
F
>::
type
;
// This cast allows the data processor to cope with
// `pair<const K, V>` value types used by `std::map`.
return
error
::
eval
([
&
]
{
return
apply
(
const_cast
<
t0
&>
(
xs
.
first
));
},
[
&
]
{
return
apply
(
xs
.
second
);
});
return
error
::
eval
([
&
]
{
return
apply
_derived
(
const_cast
<
t0
&>
(
xs
.
first
));
},
[
&
]
{
return
apply
_derived
(
xs
.
second
);
});
}
template
<
class
...
Ts
>
...
...
@@ -522,8 +517,9 @@ public:
typename
std
::
remove_reference
<
T
>::
type
>::
value
),
"a loading inspector requires mutable lvalue references"
);
auto
e
=
apply
(
deconst
(
x
));
return
e
?
e
:
(
*
this
)(
std
::
forward
<
Ts
>
(
xs
)...);
if
(
auto
err
=
apply
(
deconst
(
x
)))
return
err
;
return
apply_derived
(
std
::
forward
<
Ts
>
(
xs
)...);
}
protected
:
...
...
@@ -565,15 +561,14 @@ private:
static
typename
std
::
enable_if
<
D
::
reads_state
,
error
>::
type
convert_apply
(
D
&
self
,
T
&
x
,
U
&
storage
,
F
assign
)
{
assign
(
storage
,
x
);
return
self
.
apply
(
storage
);
return
self
(
storage
);
}
template
<
class
D
,
class
T
,
class
U
,
class
F
>
static
typename
std
::
enable_if
<!
D
::
reads_state
,
error
>::
type
convert_apply
(
D
&
self
,
T
&
x
,
U
&
storage
,
F
assign
)
{
auto
e
=
self
.
apply
(
storage
);
if
(
e
)
return
e
;
if
(
auto
err
=
self
(
storage
))
return
err
;
assign
(
x
,
storage
);
return
none
;
}
...
...
@@ -583,8 +578,13 @@ private:
return
*
static_cast
<
Derived
*>
(
this
);
}
// Applies `xs...` to `dref()`.
template
<
class
...
Ts
>
error
apply_derived
(
Ts
&&
...
xs
)
{
return
dref
()(
std
::
forward
<
Ts
>
(
xs
)...);
}
execution_unit
*
context_
;
}
;
}
// namespace caf
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