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
ed6dc95f
Commit
ed6dc95f
authored
Jun 09, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for float
parent
c249a0e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
libcaf_core/caf/config_value.hpp
libcaf_core/caf/config_value.hpp
+18
-0
No files found.
libcaf_core/caf/config_value.hpp
View file @
ed6dc95f
...
...
@@ -234,6 +234,24 @@ CAF_CONFIG_VALUE_DEFAULT_ACCESS(string);
CAF_CONFIG_VALUE_DEFAULT_ACCESS
(
list
);
CAF_CONFIG_VALUE_DEFAULT_ACCESS
(
dictionary
);
template
<
>
struct
config_value_access
<
float
>
{
static
bool
is
(
const
config_value
&
x
)
{
return
holds_alternative
<
double
>
(
x
.
get_data
());
}
static
optional
<
float
>
get_if
(
const
config_value
*
x
)
{
auto
res
=
caf
::
get_if
<
double
>
(
&
(
x
->
get_data
()));
if
(
res
)
return
static_cast
<
float
>
(
*
res
);
return
none
;
}
static
float
get
(
const
config_value
&
x
)
{
return
static_cast
<
float
>
(
caf
::
get
<
double
>
(
x
.
get_data
()));
}
};
/// Checks whether `x` is a `config_value::integer` that can convert to `T`.
/// @relates config_value
template
<
class
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