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
7f781560
Commit
7f781560
authored
Mar 21, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vector<bool> serialization, close #540
parent
45931267
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
libcaf_core/caf/data_processor.hpp
libcaf_core/caf/data_processor.hpp
+22
-0
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+1
-1
libcaf_core/test/serialization.cpp
libcaf_core/test/serialization.cpp
+8
-0
No files found.
libcaf_core/caf/data_processor.hpp
View file @
7f781560
...
...
@@ -226,6 +226,28 @@ public:
return
convert_apply
(
dref
(),
x
,
tmp
,
assign
);
}
// no better way around this abomination
error
consume_range
(
std
::
vector
<
bool
>&
xs
)
{
auto
i
=
xs
.
begin
();
auto
e
=
xs
.
end
();
using
proxy_iterator
=
decltype
(
i
);
struct
{
void
operator
()(
proxy_iterator
&
lhs
,
bool
&
rhs
)
const
{
*
lhs
=
rhs
;
}
void
operator
()(
bool
&
lhs
,
proxy_iterator
&
rhs
)
const
{
lhs
=
*
rhs
;
}
}
assign
;
bool
tmp
;
for
(;
i
!=
e
;
++
i
)
{
auto
err
=
convert_apply
(
dref
(),
i
,
tmp
,
assign
);
if
(
err
)
return
err
;
}
return
none
;
}
template
<
class
T
>
error
consume_range
(
T
&
xs
)
{
for
(
auto
&
x
:
xs
)
{
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
7f781560
...
...
@@ -137,7 +137,7 @@ public:
&&
!
has_to_string
<
T
>::
value
>
consume
(
T
&
xs
)
{
result_
+=
'['
;
for
(
auto
&
x
:
xs
)
{
for
(
auto
&
&
x
:
xs
)
{
sep
();
consume
(
deconst
(
x
));
}
...
...
libcaf_core/test/serialization.cpp
View file @
7f781560
...
...
@@ -134,6 +134,7 @@ public:
add_message_type
<
raw_struct
>
(
"raw_struct"
);
add_message_type
<
test_array
>
(
"test_array"
);
add_message_type
<
test_empty_non_pod
>
(
"test_empty_non_pod"
);
add_message_type
<
std
::
vector
<
bool
>>
(
"bool_vector"
);
}
};
...
...
@@ -474,4 +475,11 @@ CAF_TEST(long_sequences) {
CAF_CHECK_EQUAL
(
n
,
m
);
}
CAF_TEST
(
bool_vector
)
{
std
::
vector
<
bool
>
xs
{
true
,
true
,
false
,
false
,
true
};
CAF_CHECK_EQUAL
(
deep_to_string
(
xs
),
"[1, 1, 0, 0, 1]"
);
CAF_CHECK_EQUAL
(
xs
,
roundtrip
(
xs
));
CAF_CHECK_EQUAL
(
xs
,
msg_roundtrip
(
xs
));
}
CAF_TEST_FIXTURE_SCOPE_END
()
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