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
5b161de2
Commit
5b161de2
authored
Nov 22, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix float-equal warnings
parent
4b84fd0e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+17
-8
No files found.
libcaf_core/caf/detail/type_traits.hpp
View file @
5b161de2
...
@@ -159,7 +159,7 @@ struct is_primitive {
...
@@ -159,7 +159,7 @@ struct is_primitive {
};
};
/// Checks whether `T1` is comparable with `T2`.
/// Checks whether `T1` is comparable with `T2`.
template
<
class
T1
,
typename
T2
>
template
<
class
T1
,
class
T2
>
class
is_comparable
{
class
is_comparable
{
// SFINAE: If you pass a "bool*" as third argument, then
// SFINAE: If you pass a "bool*" as third argument, then
// decltype(cmp_help_fun(...)) is bool if there's an
// decltype(cmp_help_fun(...)) is bool if there's an
...
@@ -168,16 +168,25 @@ class is_comparable {
...
@@ -168,16 +168,25 @@ class is_comparable {
// cmp_help_fun(A*, B*, void*). If there's no operator==(A, B)
// cmp_help_fun(A*, B*, void*). If there's no operator==(A, B)
// available, then cmp_help_fun(A*, B*, void*) is the only
// available, then cmp_help_fun(A*, B*, void*) is the only
// candidate and thus decltype(cmp_help_fun(...)) is void.
// candidate and thus decltype(cmp_help_fun(...)) is void.
template
<
class
A
,
typename
B
>
template
<
class
A
,
class
B
>
static
bool
cmp_help_fun
(
const
A
*
arg0
,
const
B
*
arg1
,
static
bool
cmp_help_fun
(
const
A
*
arg0
,
const
B
*
arg1
,
decltype
(
*
arg0
==
*
arg1
)
*
=
nullptr
);
decltype
(
*
arg0
==
*
arg1
)
*
,
std
::
integral_constant
<
bool
,
false
>
);
template
<
class
A
,
typename
B
>
// silences float-equal warnings caused by decltype(*arg0 == *arg1)
static
void
cmp_help_fun
(
const
A
*
,
const
B
*
,
void
*
=
nullptr
);
template
<
class
A
,
class
B
>
static
bool
cmp_help_fun
(
const
A
*
,
const
B
*
,
bool
*
,
std
::
integral_constant
<
bool
,
true
>
);
template
<
class
A
,
class
B
,
class
C
>
static
void
cmp_help_fun
(
const
A
*
,
const
B
*
,
void
*
,
C
);
using
result_type
=
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
bool
*>
(
nullptr
),
std
::
integral_constant
<
bool
,
std
::
is_arithmetic
<
T1
>::
value
&&
std
::
is_arithmetic
<
T1
>::
value
>
{}));
using
result_type
=
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
bool
*>
(
nullptr
)));
public:
public:
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
};
};
...
...
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