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
f31c9945
Commit
f31c9945
authored
Apr 16, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parsing of size_t config options
parent
3aad1fdf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
libcaf_core/caf/config_option.hpp
libcaf_core/caf/config_option.hpp
+23
-14
No files found.
libcaf_core/caf/config_option.hpp
View file @
f31c9945
...
...
@@ -98,13 +98,15 @@ public:
}
private:
// Catches non-integer types.
template
<
class
T
>
static
constexpr
int
idx
(
std
::
false_type
/* is_integer */
)
{
static
constexpr
int
idx
(
std
::
false_type
)
{
return
detail
::
tl_index_of
<
legal_types
,
T
>::
value
;
}
// Catches integer types.
template
<
class
T
>
static
constexpr
int
idx
(
std
::
true_type
/* is_integer */
)
{
static
constexpr
int
idx
(
std
::
true_type
)
{
using
squashed
=
detail
::
squashed_int_t
<
T
>
;
return
detail
::
tl_index_of
<
legal_types
,
squashed
>::
value
;
}
...
...
@@ -117,8 +119,10 @@ protected:
return
true
;
}
// Catches any integer type that is smaller than int64_t.
template
<
class
T
>
static
bool
assign_config_value
(
T
&
x
,
int64_t
&
y
)
{
static
typename
std
::
enable_if
<
sizeof
(
T
)
<
sizeof
(
int64_t
),
bool
>::
type
assign_config_value
(
T
&
x
,
int64_t
&
y
)
{
if
(
y
<
static_cast
<
int64_t
>
(
std
::
numeric_limits
<
T
>::
lowest
())
||
y
>
static_cast
<
int64_t
>
(
std
::
numeric_limits
<
T
>::
max
()))
return
false
;
...
...
@@ -126,7 +130,11 @@ protected:
return
true
;
}
static
bool
assign_config_value
(
uint64_t
&
x
,
int64_t
&
y
)
{
// Catches size_t and uint64_t (yes, they differ on some compilers).
template
<
class
T
>
static
typename
std
::
enable_if
<
std
::
is_unsigned
<
T
>::
value
&&
sizeof
(
T
)
==
sizeof
(
int64_t
),
bool
>::
type
assign_config_value
(
T
&
x
,
int64_t
&
y
)
{
if
(
y
<
0
)
return
false
;
x
=
static_cast
<
uint64_t
>
(
y
);
...
...
@@ -151,7 +159,8 @@ private:
char
short_name_
;
};
template
<
class
T
,
bool
IsInsertable
=
detail
::
can_insert_elements
<
T
>()
template
<
class
T
,
bool
IsInsertable
=
detail
::
can_insert_elements
<
T
>()
&&
!
std
::
is_same
<
T
,
std
::
string
>::
value
>
class
config_option_impl
:
public
config_option
{
public:
...
...
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