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
ee5ce710
Commit
ee5ce710
authored
Aug 02, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build on Clang 7/8
parent
5d25fbf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
14 deletions
+15
-14
libcaf_core/caf/inspector_access.hpp
libcaf_core/caf/inspector_access.hpp
+13
-12
libcaf_core/test/nasty.cpp
libcaf_core/test/nasty.cpp
+1
-1
libcaf_core/test/nasty.hpp
libcaf_core/test/nasty.hpp
+1
-1
No files found.
libcaf_core/caf/inspector_access.hpp
View file @
ee5ce710
...
@@ -411,7 +411,7 @@ template <class... Ts>
...
@@ -411,7 +411,7 @@ template <class... Ts>
struct
inspector_access
<
variant
<
Ts
...
>>
{
struct
inspector_access
<
variant
<
Ts
...
>>
{
using
value_type
=
variant
<
Ts
...
>
;
using
value_type
=
variant
<
Ts
...
>
;
static
constexpr
type_id_t
allowed_types
[]
=
{
type_id_v
<
Ts
>
...};
static
constexpr
type_id_t
allowed_types
_arr
[]
=
{
type_id_v
<
Ts
>
...};
template
<
class
Inspector
>
template
<
class
Inspector
>
[[
nodiscard
]]
static
bool
apply_object
(
Inspector
&
f
,
value_type
&
x
)
{
[[
nodiscard
]]
static
bool
apply_object
(
Inspector
&
f
,
value_type
&
x
)
{
...
@@ -428,23 +428,23 @@ struct inspector_access<variant<Ts...>> {
...
@@ -428,23 +428,23 @@ struct inspector_access<variant<Ts...>> {
template
<
class
Inspector
>
template
<
class
Inspector
>
static
bool
save_field
(
Inspector
&
f
,
string_view
field_name
,
value_type
&
x
)
{
static
bool
save_field
(
Inspector
&
f
,
string_view
field_name
,
value_type
&
x
)
{
auto
g
=
[
&
f
](
auto
&
y
)
{
return
inspect_value
(
f
,
y
);
};
auto
g
=
[
&
f
](
auto
&
y
)
{
return
inspect_value
(
f
,
y
);
};
return
f
.
begin_field
(
field_name
,
make_span
(
allowed_types
),
x
.
index
())
//
return
f
.
begin_field
(
field_name
,
make_span
(
allowed_types
_arr
),
x
.
index
())
//
&&
visit
(
g
,
x
)
//
&&
visit
(
g
,
x
)
//
&&
f
.
end_field
();
&&
f
.
end_field
();
}
}
template
<
class
Inspector
,
class
IsPresent
,
class
Get
>
template
<
class
Inspector
,
class
IsPresent
,
class
Get
>
static
bool
save_field
(
Inspector
&
f
,
string_view
field_name
,
static
bool
save_field
(
Inspector
&
f
,
string_view
field_name
,
IsPresent
&
is_present
,
Get
&
get
)
{
IsPresent
&
is_present
,
Get
&
get
)
{
auto
allowed_types
=
make_span
(
allowed_types_arr
);
if
(
is_present
())
{
if
(
is_present
())
{
auto
&&
x
=
get
();
auto
&&
x
=
get
();
auto
g
=
[
&
f
](
auto
&
y
)
{
return
inspect_value
(
f
,
y
);
};
auto
g
=
[
&
f
](
auto
&
y
)
{
return
inspect_value
(
f
,
y
);
};
return
f
.
begin_field
(
field_name
,
true
,
make_span
(
allowed_types
),
return
f
.
begin_field
(
field_name
,
true
,
allowed_types
,
x
.
index
())
//
x
.
index
())
//
&&
visit
(
g
,
x
)
//
&&
visit
(
g
,
x
)
//
&&
f
.
end_field
();
&&
f
.
end_field
();
}
}
return
f
.
begin_field
(
field_name
,
false
,
make_span
(
allowed_types
)
,
0
)
//
return
f
.
begin_field
(
field_name
,
false
,
allowed_types
,
0
)
//
&&
f
.
end_field
();
&&
f
.
end_field
();
}
}
...
@@ -473,9 +473,10 @@ struct inspector_access<variant<Ts...>> {
...
@@ -473,9 +473,10 @@ struct inspector_access<variant<Ts...>> {
static
bool
load_field
(
Inspector
&
f
,
string_view
field_name
,
value_type
&
x
,
static
bool
load_field
(
Inspector
&
f
,
string_view
field_name
,
value_type
&
x
,
IsValid
&
is_valid
,
SyncValue
&
sync_value
)
{
IsValid
&
is_valid
,
SyncValue
&
sync_value
)
{
size_t
type_index
=
std
::
numeric_limits
<
size_t
>::
max
();
size_t
type_index
=
std
::
numeric_limits
<
size_t
>::
max
();
if
(
!
f
.
begin_field
(
field_name
,
make_span
(
allowed_types
),
type_index
))
auto
allowed_types
=
make_span
(
allowed_types_arr
);
if
(
!
f
.
begin_field
(
field_name
,
allowed_types
,
type_index
))
return
false
;
return
false
;
if
(
type_index
>=
std
::
size
(
allowed_types
))
if
(
type_index
>=
allowed_types
.
size
(
))
return
f
.
load_field_failed
(
field_name
,
sec
::
invalid_field_type
);
return
f
.
load_field_failed
(
field_name
,
sec
::
invalid_field_type
);
auto
runtime_type
=
allowed_types
[
type_index
];
auto
runtime_type
=
allowed_types
[
type_index
];
detail
::
type_list
<
Ts
...
>
types
;
detail
::
type_list
<
Ts
...
>
types
;
...
@@ -494,12 +495,12 @@ struct inspector_access<variant<Ts...>> {
...
@@ -494,12 +495,12 @@ struct inspector_access<variant<Ts...>> {
IsValid
&
is_valid
,
SyncValue
&
sync_value
,
IsValid
&
is_valid
,
SyncValue
&
sync_value
,
SetFallback
&
set_fallback
)
{
SetFallback
&
set_fallback
)
{
bool
is_present
=
false
;
bool
is_present
=
false
;
auto
allowed_types
=
make_span
(
allowed_types_arr
);
size_t
type_index
=
std
::
numeric_limits
<
size_t
>::
max
();
size_t
type_index
=
std
::
numeric_limits
<
size_t
>::
max
();
if
(
!
f
.
begin_field
(
field_name
,
is_present
,
make_span
(
allowed_types
),
if
(
!
f
.
begin_field
(
field_name
,
is_present
,
allowed_types
,
type_index
))
type_index
))
return
false
;
return
false
;
if
(
is_present
)
{
if
(
is_present
)
{
if
(
type_index
>=
std
::
size
(
allowed_types
))
if
(
type_index
>=
allowed_types
.
size
(
))
return
f
.
load_field_failed
(
field_name
,
sec
::
invalid_field_type
);
return
f
.
load_field_failed
(
field_name
,
sec
::
invalid_field_type
);
auto
runtime_type
=
allowed_types
[
type_index
];
auto
runtime_type
=
allowed_types
[
type_index
];
detail
::
type_list
<
Ts
...
>
types
;
detail
::
type_list
<
Ts
...
>
types
;
...
...
libcaf_core/test/nasty.cpp
View file @
ee5ce710
...
@@ -21,7 +21,7 @@ std::string to_string(weekday x) {
...
@@ -21,7 +21,7 @@ std::string to_string(weekday x) {
}
}
}
}
bool
parse
(
std
::
string_view
input
,
weekday
&
dest
)
{
bool
parse
(
caf
::
string_view
input
,
weekday
&
dest
)
{
if
(
input
==
"monday"
)
{
if
(
input
==
"monday"
)
{
dest
=
weekday
::
monday
;
dest
=
weekday
::
monday
;
return
true
;
return
true
;
...
...
libcaf_core/test/nasty.hpp
View file @
ee5ce710
...
@@ -21,7 +21,7 @@ enum class weekday {
...
@@ -21,7 +21,7 @@ enum class weekday {
std
::
string
to_string
(
weekday
x
);
std
::
string
to_string
(
weekday
x
);
bool
parse
(
std
::
string_view
input
,
weekday
&
dest
);
bool
parse
(
caf
::
string_view
input
,
weekday
&
dest
);
namespace
caf
{
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