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
8f94dc06
Unverified
Commit
8f94dc06
authored
Aug 11, 2023
by
Dominik Charousset
Committed by
GitHub
Aug 11, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1521
refactor $pred::value to $pred_v
parents
428eaaa7
cf5d947b
Changes
60
Hide whitespace changes
Inline
Side-by-side
Showing
60 changed files
with
235 additions
and
220 deletions
+235
-220
libcaf_core/caf/actor_cast.hpp
libcaf_core/caf/actor_cast.hpp
+11
-7
libcaf_core/caf/actor_factory.hpp
libcaf_core/caf/actor_factory.hpp
+5
-6
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+2
-2
libcaf_core/caf/actor_traits.hpp
libcaf_core/caf/actor_traits.hpp
+6
-7
libcaf_core/caf/binary_deserializer.hpp
libcaf_core/caf/binary_deserializer.hpp
+1
-1
libcaf_core/caf/binary_serializer.hpp
libcaf_core/caf/binary_serializer.hpp
+1
-1
libcaf_core/caf/blocking_actor.hpp
libcaf_core/caf/blocking_actor.hpp
+1
-1
libcaf_core/caf/byte.hpp
libcaf_core/caf/byte.hpp
+1
-1
libcaf_core/caf/catch_all.hpp
libcaf_core/caf/catch_all.hpp
+1
-1
libcaf_core/caf/config_value.hpp
libcaf_core/caf/config_value.hpp
+6
-7
libcaf_core/caf/config_value_reader.cpp
libcaf_core/caf/config_value_reader.cpp
+3
-3
libcaf_core/caf/deduce_mpi.hpp
libcaf_core/caf/deduce_mpi.hpp
+1
-1
libcaf_core/caf/deserializer.hpp
libcaf_core/caf/deserializer.hpp
+1
-1
libcaf_core/caf/detail/implicit_conversions.hpp
libcaf_core/caf/detail/implicit_conversions.hpp
+3
-3
libcaf_core/caf/detail/init_fun_factory.hpp
libcaf_core/caf/detail/init_fun_factory.hpp
+4
-4
libcaf_core/caf/detail/parse.hpp
libcaf_core/caf/detail/parse.hpp
+1
-1
libcaf_core/caf/detail/parser/read_signed_integer.hpp
libcaf_core/caf/detail/parser/read_signed_integer.hpp
+1
-2
libcaf_core/caf/detail/parser/read_unsigned_integer.hpp
libcaf_core/caf/detail/parser/read_unsigned_integer.hpp
+2
-2
libcaf_core/caf/detail/print.hpp
libcaf_core/caf/detail/print.hpp
+3
-3
libcaf_core/caf/detail/spawn_fwd.hpp
libcaf_core/caf/detail/spawn_fwd.hpp
+1
-1
libcaf_core/caf/detail/squashed_int.hpp
libcaf_core/caf/detail/squashed_int.hpp
+2
-2
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+6
-7
libcaf_core/caf/detail/type_list.hpp
libcaf_core/caf/detail/type_list.hpp
+6
-6
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+51
-26
libcaf_core/caf/detail/typed_actor_util.hpp
libcaf_core/caf/detail/typed_actor_util.hpp
+2
-3
libcaf_core/caf/detail/unique_function.hpp
libcaf_core/caf/detail/unique_function.hpp
+2
-2
libcaf_core/caf/exec_main.hpp
libcaf_core/caf/exec_main.hpp
+4
-4
libcaf_core/caf/expected.hpp
libcaf_core/caf/expected.hpp
+5
-7
libcaf_core/caf/hash/fnv.hpp
libcaf_core/caf/hash/fnv.hpp
+1
-1
libcaf_core/caf/hash/sha1.hpp
libcaf_core/caf/hash/sha1.hpp
+1
-1
libcaf_core/caf/infer_handle.hpp
libcaf_core/caf/infer_handle.hpp
+7
-3
libcaf_core/caf/inspector_access.hpp
libcaf_core/caf/inspector_access.hpp
+5
-5
libcaf_core/caf/intrusive/forward_iterator.hpp
libcaf_core/caf/intrusive/forward_iterator.hpp
+3
-3
libcaf_core/caf/intrusive_ptr.hpp
libcaf_core/caf/intrusive_ptr.hpp
+3
-4
libcaf_core/caf/load_inspector.hpp
libcaf_core/caf/load_inspector.hpp
+1
-1
libcaf_core/caf/load_inspector_base.hpp
libcaf_core/caf/load_inspector_base.hpp
+3
-3
libcaf_core/caf/logger.hpp
libcaf_core/caf/logger.hpp
+1
-1
libcaf_core/caf/mailbox_element.hpp
libcaf_core/caf/mailbox_element.hpp
+1
-1
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+2
-2
libcaf_core/caf/mixin/sender.hpp
libcaf_core/caf/mixin/sender.hpp
+1
-2
libcaf_core/caf/mtl.hpp
libcaf_core/caf/mtl.hpp
+3
-3
libcaf_core/caf/node_id.cpp
libcaf_core/caf/node_id.cpp
+2
-1
libcaf_core/caf/optional.hpp
libcaf_core/caf/optional.hpp
+3
-5
libcaf_core/caf/save_inspector.hpp
libcaf_core/caf/save_inspector.hpp
+1
-1
libcaf_core/caf/save_inspector_base.hpp
libcaf_core/caf/save_inspector_base.hpp
+1
-1
libcaf_core/caf/serializer.hpp
libcaf_core/caf/serializer.hpp
+1
-1
libcaf_core/caf/stateful_actor.hpp
libcaf_core/caf/stateful_actor.hpp
+2
-2
libcaf_core/caf/string_view.hpp
libcaf_core/caf/string_view.hpp
+3
-4
libcaf_core/caf/telemetry/collector/prometheus.cpp
libcaf_core/caf/telemetry/collector/prometheus.cpp
+2
-2
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+1
-1
libcaf_core/caf/typed_response_promise.hpp
libcaf_core/caf/typed_response_promise.hpp
+1
-2
libcaf_core/caf/weak_intrusive_ptr.hpp
libcaf_core/caf/weak_intrusive_ptr.hpp
+1
-2
libcaf_core/tests/legacy/config_option.cpp
libcaf_core/tests/legacy/config_option.cpp
+1
-1
libcaf_core/tests/legacy/detail/parser/read_number.cpp
libcaf_core/tests/legacy/detail/parser/read_number.cpp
+2
-3
libcaf_core/tests/legacy/detail/parser/read_number_or_timespan.cpp
...re/tests/legacy/detail/parser/read_number_or_timespan.cpp
+2
-3
libcaf_core/tests/legacy/metaprogramming.cpp
libcaf_core/tests/legacy/metaprogramming.cpp
+10
-10
libcaf_core/tests/legacy/typed_spawn.cpp
libcaf_core/tests/legacy/typed_spawn.cpp
+3
-3
libcaf_io/caf/io/typed_broker.hpp
libcaf_io/caf/io/typed_broker.hpp
+4
-4
libcaf_test/caf/test/dsl.hpp
libcaf_test/caf/test/dsl.hpp
+2
-2
libcaf_test/caf/test/unit_test.hpp
libcaf_test/caf/test/unit_test.hpp
+28
-30
No files found.
libcaf_core/caf/actor_cast.hpp
View file @
8f94dc06
...
@@ -48,6 +48,10 @@ struct is_weak_ptr {
...
@@ -48,6 +48,10 @@ struct is_weak_ptr {
static
constexpr
bool
value
=
T
::
has_weak_ptr_semantics
;
static
constexpr
bool
value
=
T
::
has_weak_ptr_semantics
;
};
};
/// Convenience alias for `is_weak_ptr<T>::value`.
template
<
class
T
>
inline
constexpr
bool
is_weak_ptr_v
=
is_weak_ptr
<
T
>::
value
;
template
<
class
T
>
template
<
class
T
>
struct
is_weak_ptr
<
T
*>
:
std
::
false_type
{};
struct
is_weak_ptr
<
T
*>
:
std
::
false_type
{};
...
@@ -71,7 +75,7 @@ public:
...
@@ -71,7 +75,7 @@ public:
}
}
template
<
class
T
,
template
<
class
T
,
class
=
typename
std
::
enable_if
<!
std
::
is_pointer
<
T
>
::
value
>::
type
>
class
=
typename
std
::
enable_if
<!
std
::
is_pointer
_v
<
T
>
>::
type
>
To
operator
()(
const
T
&
x
)
const
{
To
operator
()(
const
T
&
x
)
const
{
return
x
.
get
();
return
x
.
get
();
}
}
...
@@ -89,7 +93,7 @@ public:
...
@@ -89,7 +93,7 @@ public:
}
}
template
<
class
T
,
template
<
class
T
,
class
=
typename
std
::
enable_if
<!
std
::
is_pointer
<
T
>
::
value
>::
type
>
class
=
typename
std
::
enable_if
<!
std
::
is_pointer
_v
<
T
>
>::
type
>
To
*
operator
()(
const
T
&
x
)
const
{
To
*
operator
()(
const
T
&
x
)
const
{
return
(
*
this
)(
x
.
get
());
return
(
*
this
)(
x
.
get
());
}
}
...
@@ -107,7 +111,7 @@ public:
...
@@ -107,7 +111,7 @@ public:
}
}
template
<
class
T
,
template
<
class
T
,
class
=
typename
std
::
enable_if
<!
std
::
is_pointer
<
T
>
::
value
>::
type
>
class
=
typename
std
::
enable_if
<!
std
::
is_pointer
_v
<
T
>
>::
type
>
actor_control_block
*
operator
()(
const
T
&
x
)
const
{
actor_control_block
*
operator
()(
const
T
&
x
)
const
{
return
x
.
get
();
return
x
.
get
();
}
}
...
@@ -148,11 +152,11 @@ T actor_cast(U&& what) {
...
@@ -148,11 +152,11 @@ T actor_cast(U&& what) {
using
from_type
=
using
from_type
=
typename
std
::
remove_const
<
typename
std
::
remove_reference
<
U
>::
type
>::
type
;
typename
std
::
remove_const
<
typename
std
::
remove_reference
<
U
>::
type
>::
type
;
// query traits for T
// query traits for T
constexpr
bool
to_raw
=
std
::
is_pointer
<
T
>::
value
;
constexpr
bool
to_raw
=
std
::
is_pointer
_v
<
T
>
;
constexpr
bool
to_weak
=
is_weak_ptr
<
T
>::
value
;
constexpr
bool
to_weak
=
is_weak_ptr
_v
<
T
>
;
// query traits for U
// query traits for U
constexpr
bool
from_raw
=
std
::
is_pointer
<
from_type
>::
value
;
constexpr
bool
from_raw
=
std
::
is_pointer
_v
<
from_type
>
;
constexpr
bool
from_weak
=
is_weak_ptr
<
from_type
>::
value
;
constexpr
bool
from_weak
=
is_weak_ptr
_v
<
from_type
>
;
// calculate x and y
// calculate x and y
constexpr
int
x
=
to_raw
?
0
:
(
to_weak
?
2
:
1
);
constexpr
int
x
=
to_raw
?
0
:
(
to_weak
?
2
:
1
);
constexpr
int
y
=
from_raw
?
0
:
(
from_weak
?
3
:
6
);
constexpr
int
y
=
from_raw
?
0
:
(
from_weak
?
3
:
6
);
...
...
libcaf_core/caf/actor_factory.hpp
View file @
8f94dc06
...
@@ -36,7 +36,7 @@ public:
...
@@ -36,7 +36,7 @@ public:
}
}
void
operator
()(
Ts
...
xs
)
{
void
operator
()(
Ts
...
xs
)
{
if
constexpr
(
std
::
is_convertible
<
R
,
Bhvr
>::
value
)
{
if
constexpr
(
std
::
is_convertible
_v
<
R
,
Bhvr
>
)
{
auto
bhvr
=
f_
(
xs
...);
auto
bhvr
=
f_
(
xs
...);
*
bhvr_
=
std
::
move
(
bhvr
.
unbox
());
*
bhvr_
=
std
::
move
(
bhvr
.
unbox
());
}
else
{
}
else
{
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
}
}
void
operator
()(
Ts
...
xs
)
{
void
operator
()(
Ts
...
xs
)
{
if
constexpr
(
std
::
is_convertible
<
R
,
Bhvr
>::
value
)
{
if
constexpr
(
std
::
is_convertible
_v
<
R
,
Bhvr
>
)
{
auto
bhvr
=
f_
(
ptr_
,
xs
...);
auto
bhvr
=
f_
(
ptr_
,
xs
...);
*
bhvr_
=
std
::
move
(
bhvr
.
unbox
());
*
bhvr_
=
std
::
move
(
bhvr
.
unbox
());
}
else
{
}
else
{
...
@@ -142,10 +142,9 @@ actor_factory_result dyn_spawn_class(actor_config& cfg, message& msg) {
...
@@ -142,10 +142,9 @@ actor_factory_result dyn_spawn_class(actor_config& cfg, message& msg) {
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
actor_factory
make_actor_factory
()
{
actor_factory
make_actor_factory
()
{
static_assert
(
static_assert
(
detail
::
conjunction
<
std
::
is_lvalue_reference_v
<
Ts
>
...
>::
value
,
detail
::
conjunction
<
std
::
is_lvalue_reference
<
Ts
>::
value
...
>::
value
,
"all Ts must be lvalue references"
);
"all Ts must be lvalue references"
);
static_assert
(
std
::
is_base_of_v
<
local_actor
,
T
>
,
static_assert
(
std
::
is_base_of
<
local_actor
,
T
>::
value
,
"T is not derived from local_actor"
);
"T is not derived from local_actor"
);
return
&
dyn_spawn_class
<
T
,
Ts
...
>
;
return
&
dyn_spawn_class
<
T
,
Ts
...
>
;
}
}
...
...
libcaf_core/caf/actor_system.hpp
View file @
8f94dc06
...
@@ -446,7 +446,7 @@ public:
...
@@ -446,7 +446,7 @@ public:
/// with the arguments stored in `args`.
/// with the arguments stored in `args`.
/// @experimental
/// @experimental
template
<
class
Handle
,
template
<
class
Handle
,
class
E
=
typename
std
::
enable_if
<
is_handle
<
Handle
>
::
value
>::
type
>
class
E
=
typename
std
::
enable_if
<
is_handle
_v
<
Handle
>
>::
type
>
expected
<
Handle
>
expected
<
Handle
>
spawn
(
const
std
::
string
&
name
,
message
args
,
execution_unit
*
ctx
=
nullptr
,
spawn
(
const
std
::
string
&
name
,
message
args
,
execution_unit
*
ctx
=
nullptr
,
bool
check_interface
=
true
,
const
mpi
*
expected_ifs
=
nullptr
)
{
bool
check_interface
=
true
,
const
mpi
*
expected_ifs
=
nullptr
)
{
...
@@ -778,7 +778,7 @@ public:
...
@@ -778,7 +778,7 @@ public:
private:
private:
template
<
class
T
>
template
<
class
T
>
void
check_invariants
()
{
void
check_invariants
()
{
static_assert
(
!
std
::
is_base_of
<
prohibit_top_level_spawn_marker
,
T
>::
value
,
static_assert
(
!
std
::
is_base_of
_v
<
prohibit_top_level_spawn_marker
,
T
>
,
"This actor type cannot be spawned through an actor system. "
"This actor type cannot be spawned through an actor system. "
"Probably you have tried to spawn a broker."
);
"Probably you have tried to spawn a broker."
);
}
}
...
...
libcaf_core/caf/actor_traits.hpp
View file @
8f94dc06
...
@@ -60,20 +60,19 @@ template <class T>
...
@@ -60,20 +60,19 @@ template <class T>
struct
default_actor_traits
<
T
,
true
>
{
struct
default_actor_traits
<
T
,
true
>
{
/// Denotes whether `T` is dynamically typed.
/// Denotes whether `T` is dynamically typed.
static
constexpr
bool
is_dynamically_typed
static
constexpr
bool
is_dynamically_typed
=
std
::
is_base_of
<
dynamically_typed_actor_base
,
T
>::
value
;
=
std
::
is_base_of
_v
<
dynamically_typed_actor_base
,
T
>
;
/// Denotes whether `T` is statically typed.
/// Denotes whether `T` is statically typed.
static
constexpr
bool
is_statically_typed
static
constexpr
bool
is_statically_typed
=
std
::
is_base_of
<
statically_typed_actor_base
,
T
>::
value
;
=
std
::
is_base_of
_v
<
statically_typed_actor_base
,
T
>
;
/// Denotes whether `T` is a blocking actor type.
/// Denotes whether `T` is a blocking actor type.
static
constexpr
bool
is_blocking
static
constexpr
bool
is_blocking
=
std
::
is_base_of_v
<
blocking_actor_base
,
T
>
=
std
::
is_base_of
<
blocking_actor_base
,
T
>::
value
||
mixin
::
is_blocking_requester
<
T
>::
value
;
||
mixin
::
is_blocking_requester
<
T
>::
value
;
/// Denotes whether `T` is a non-blocking actor type.
/// Denotes whether `T` is a non-blocking actor type.
static
constexpr
bool
is_non_blocking
static
constexpr
bool
is_non_blocking
=
std
::
is_base_of
<
non_blocking_actor_base
,
T
>::
value
;
=
std
::
is_base_of
_v
<
non_blocking_actor_base
,
T
>
;
/// Denotes whether `T` is an incomplete actor type that misses one or more
/// Denotes whether `T` is an incomplete actor type that misses one or more
/// markers.
/// markers.
...
@@ -91,6 +90,6 @@ struct default_actor_traits<T, true> {
...
@@ -91,6 +90,6 @@ struct default_actor_traits<T, true> {
/// Provides uniform access to properties of actor types.
/// Provides uniform access to properties of actor types.
template
<
class
T
>
template
<
class
T
>
struct
actor_traits
struct
actor_traits
:
default_actor_traits
<
T
,
std
::
is_base_of
<
abstract_actor
,
T
>::
value
>
{};
:
default_actor_traits
<
T
,
std
::
is_base_of
_v
<
abstract_actor
,
T
>
>
{};
}
// namespace caf
}
// namespace caf
libcaf_core/caf/binary_deserializer.hpp
View file @
8f94dc06
...
@@ -174,7 +174,7 @@ public:
...
@@ -174,7 +174,7 @@ public:
bool
value
(
uint64_t
&
x
)
noexcept
;
bool
value
(
uint64_t
&
x
)
noexcept
;
template
<
class
T
>
template
<
class
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
bool
>
value
(
T
&
x
)
noexcept
{
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
,
bool
>
value
(
T
&
x
)
noexcept
{
auto
tmp
=
detail
::
squashed_int_t
<
T
>
{
0
};
auto
tmp
=
detail
::
squashed_int_t
<
T
>
{
0
};
if
(
value
(
tmp
))
{
if
(
value
(
tmp
))
{
x
=
static_cast
<
T
>
(
tmp
);
x
=
static_cast
<
T
>
(
tmp
);
...
...
libcaf_core/caf/binary_serializer.hpp
View file @
8f94dc06
...
@@ -157,7 +157,7 @@ public:
...
@@ -157,7 +157,7 @@ public:
bool
value
(
uint64_t
x
);
bool
value
(
uint64_t
x
);
template
<
class
T
>
template
<
class
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
bool
>
value
(
T
x
)
{
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
,
bool
>
value
(
T
x
)
{
return
value
(
static_cast
<
detail
::
squashed_int_t
<
T
>>
(
x
));
return
value
(
static_cast
<
detail
::
squashed_int_t
<
T
>>
(
x
));
}
}
...
...
libcaf_core/caf/blocking_actor.hpp
View file @
8f94dc06
...
@@ -312,7 +312,7 @@ public:
...
@@ -312,7 +312,7 @@ public:
filtered
tk
;
filtered
tk
;
behavior
bhvr
{
apply_moved_args
(
make_behavior_impl
,
get_indices
(
tk
),
tup
)};
behavior
bhvr
{
apply_moved_args
(
make_behavior_impl
,
get_indices
(
tk
),
tup
)};
using
tail_indices
=
using
tail_indices
=
typename
il_range
<
tl_size
<
filtered
>::
value
,
sizeof
...(
Ts
)
>::
type
;
typename
il_range
<
tl_size
_v
<
filtered
>
,
sizeof
...(
Ts
)
>::
type
;
make_blocking_behavior_t
factory
;
make_blocking_behavior_t
factory
;
auto
fun
=
apply_moved_args_prefixed
(
factory
,
tail_indices
{},
tup
,
&
bhvr
);
auto
fun
=
apply_moved_args_prefixed
(
factory
,
tail_indices
{},
tup
,
&
bhvr
);
receive_impl
(
rcc
,
mid
,
fun
);
receive_impl
(
rcc
,
mid
,
fun
);
...
...
libcaf_core/caf/byte.hpp
View file @
8f94dc06
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
namespace
caf
{
namespace
caf
{
template
<
class
IntegerType
,
template
<
class
IntegerType
,
class
=
std
::
enable_if_t
<
std
::
is_integral
<
IntegerType
>
::
value
>>
class
=
std
::
enable_if_t
<
std
::
is_integral
_v
<
IntegerType
>
>>
[[
deprecated
(
"use std::to_integer instead"
)]]
constexpr
IntegerType
[[
deprecated
(
"use std::to_integer instead"
)]]
constexpr
IntegerType
to_integer
(
std
::
byte
x
)
noexcept
{
to_integer
(
std
::
byte
x
)
noexcept
{
return
static_cast
<
IntegerType
>
(
x
);
return
static_cast
<
IntegerType
>
(
x
);
...
...
libcaf_core/caf/catch_all.hpp
View file @
8f94dc06
...
@@ -16,7 +16,7 @@ template <class F>
...
@@ -16,7 +16,7 @@ template <class F>
struct
catch_all
{
struct
catch_all
{
using
fun_type
=
std
::
function
<
skippable_result
(
message
&
)
>
;
using
fun_type
=
std
::
function
<
skippable_result
(
message
&
)
>
;
static_assert
(
std
::
is_convertible
<
F
,
fun_type
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
F
,
fun_type
>
,
"catch-all handler must have signature "
"catch-all handler must have signature "
"skippable_result (message&)"
);
"skippable_result (message&)"
);
...
...
libcaf_core/caf/config_value.hpp
View file @
8f94dc06
...
@@ -290,14 +290,14 @@ private:
...
@@ -290,14 +290,14 @@ private:
void
set
(
T
x
)
{
void
set
(
T
x
)
{
if
constexpr
(
detail
::
is_config_value_type_v
<
T
>
)
{
if
constexpr
(
detail
::
is_config_value_type_v
<
T
>
)
{
data_
=
std
::
move
(
x
);
data_
=
std
::
move
(
x
);
}
else
if
constexpr
(
std
::
is_integral
<
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_integral
_v
<
T
>
)
{
data_
=
static_cast
<
int64_t
>
(
x
);
data_
=
static_cast
<
int64_t
>
(
x
);
}
else
if
constexpr
(
std
::
is_convertible
<
T
,
const
char
*>::
value
)
{
}
else
if
constexpr
(
std
::
is_convertible
<
T
,
const
char
*>::
value
)
{
data_
=
std
::
string
{
x
};
data_
=
std
::
string
{
x
};
}
else
{
}
else
{
static_assert
(
detail
::
is_iterable
<
T
>::
value
);
static_assert
(
detail
::
is_iterable
<
T
>::
value
);
using
value_type
=
typename
T
::
value_type
;
using
value_type
=
typename
T
::
value_type
;
detail
::
bool_token
<
detail
::
is_pair
<
value_type
>::
value
>
is_map_type
;
detail
::
bool_token
<
detail
::
is_pair
_v
<
value_type
>
>
is_map_type
;
set_range
(
x
,
is_map_type
);
set_range
(
x
,
is_map_type
);
}
}
}
}
...
@@ -365,7 +365,7 @@ expected<T> get_as(const config_value& x, inspector_access_type::builtin) {
...
@@ -365,7 +365,7 @@ expected<T> get_as(const config_value& x, inspector_access_type::builtin) {
return
to_string
(
x
);
return
to_string
(
x
);
}
else
if
constexpr
(
std
::
is_same_v
<
T
,
bool
>
)
{
}
else
if
constexpr
(
std
::
is_same_v
<
T
,
bool
>
)
{
return
x
.
to_boolean
();
return
x
.
to_boolean
();
}
else
if
constexpr
(
std
::
is_integral
<
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_integral
_v
<
T
>
)
{
if
(
auto
result
=
x
.
to_integer
())
{
if
(
auto
result
=
x
.
to_integer
())
{
if
(
detail
::
bounds_checker
<
T
>::
check
(
*
result
))
if
(
detail
::
bounds_checker
<
T
>::
check
(
*
result
))
return
static_cast
<
T
>
(
*
result
);
return
static_cast
<
T
>
(
*
result
);
...
@@ -374,7 +374,7 @@ expected<T> get_as(const config_value& x, inspector_access_type::builtin) {
...
@@ -374,7 +374,7 @@ expected<T> get_as(const config_value& x, inspector_access_type::builtin) {
}
else
{
}
else
{
return
std
::
move
(
result
.
error
());
return
std
::
move
(
result
.
error
());
}
}
}
else
if
constexpr
(
std
::
is_floating_point
<
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_floating_point
_v
<
T
>
)
{
if
(
auto
result
=
x
.
to_real
())
{
if
(
auto
result
=
x
.
to_real
())
{
if
constexpr
(
sizeof
(
T
)
>=
sizeof
(
config_value
::
real
))
{
if
constexpr
(
sizeof
(
T
)
>=
sizeof
(
config_value
::
real
))
{
return
*
result
;
return
*
result
;
...
@@ -419,10 +419,9 @@ get_as_tuple(const config_value::list& x, std::index_sequence<Is...>) {
...
@@ -419,10 +419,9 @@ get_as_tuple(const config_value::list& x, std::index_sequence<Is...>) {
template
<
class
T
>
template
<
class
T
>
expected
<
T
>
get_as
(
const
config_value
&
x
,
inspector_access_type
::
tuple
)
{
expected
<
T
>
get_as
(
const
config_value
&
x
,
inspector_access_type
::
tuple
)
{
static_assert
(
!
std
::
is_array
<
T
>::
value
,
static_assert
(
!
std
::
is_array_v
<
T
>
,
"cannot return an array from a function"
);
"cannot return an array from a function"
);
if
(
auto
wrapped_values
=
x
.
to_list
())
{
if
(
auto
wrapped_values
=
x
.
to_list
())
{
static
constexpr
size_t
n
=
std
::
tuple_size
<
T
>::
value
;
static
constexpr
size_t
n
=
std
::
tuple_size
_v
<
T
>
;
if
(
wrapped_values
->
size
()
==
n
)
if
(
wrapped_values
->
size
()
==
n
)
return
get_as_tuple
<
T
>
(
*
wrapped_values
,
std
::
make_index_sequence
<
n
>
{});
return
get_as_tuple
<
T
>
(
*
wrapped_values
,
std
::
make_index_sequence
<
n
>
{});
else
else
...
...
libcaf_core/caf/config_value_reader.cpp
View file @
8f94dc06
...
@@ -403,10 +403,10 @@ namespace {
...
@@ -403,10 +403,10 @@ namespace {
template
<
class
T
>
template
<
class
T
>
bool
pull
(
config_value_reader
&
reader
,
T
&
x
)
{
bool
pull
(
config_value_reader
&
reader
,
T
&
x
)
{
using
internal_type
=
std
::
conditional_t
<
std
::
is_floating_point
<
T
>::
value
,
using
internal_type
config_value
::
real
,
T
>
;
=
std
::
conditional_t
<
std
::
is_floating_point_v
<
T
>
,
config_value
::
real
,
T
>
;
auto
assign
=
[
&
x
](
auto
&
result
)
{
auto
assign
=
[
&
x
](
auto
&
result
)
{
if
constexpr
(
std
::
is_floating_point
<
T
>::
value
)
{
if
constexpr
(
std
::
is_floating_point
_v
<
T
>
)
{
x
=
static_cast
<
T
>
(
result
);
x
=
static_cast
<
T
>
(
result
);
}
else
{
}
else
{
x
=
result
;
x
=
result
;
...
...
libcaf_core/caf/deduce_mpi.hpp
View file @
8f94dc06
...
@@ -42,7 +42,7 @@ struct dmi<typed_response_promise<Out...>(In...)> {
...
@@ -42,7 +42,7 @@ struct dmi<typed_response_promise<Out...>(In...)> {
// -- dmfou = deduce_mpi_function_object_unboxing
// -- dmfou = deduce_mpi_function_object_unboxing
template
<
class
T
,
bool
isClass
=
std
::
is_class
<
T
>
::
value
>
template
<
class
T
,
bool
isClass
=
std
::
is_class
_v
<
T
>
>
struct
dmfou
;
struct
dmfou
;
// case #1a: const member function pointer
// case #1a: const member function pointer
...
...
libcaf_core/caf/deserializer.hpp
View file @
8f94dc06
...
@@ -158,7 +158,7 @@ public:
...
@@ -158,7 +158,7 @@ public:
/// @copydoc value
/// @copydoc value
template
<
class
T
>
template
<
class
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
bool
>
value
(
T
&
x
)
noexcept
{
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
,
bool
>
value
(
T
&
x
)
noexcept
{
auto
tmp
=
detail
::
squashed_int_t
<
T
>
{
0
};
auto
tmp
=
detail
::
squashed_int_t
<
T
>
{
0
};
if
(
value
(
tmp
))
{
if
(
value
(
tmp
))
{
x
=
static_cast
<
T
>
(
tmp
);
x
=
static_cast
<
T
>
(
tmp
);
...
...
libcaf_core/caf/detail/implicit_conversions.hpp
View file @
8f94dc06
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
namespace
caf
::
detail
{
namespace
caf
::
detail
{
template
<
class
T
,
template
<
class
T
,
bool
IsDyn
=
std
::
is_base_of
<
dynamically_typed_actor_base
,
T
>
::
value
,
bool
IsDyn
=
std
::
is_base_of
_v
<
dynamically_typed_actor_base
,
T
>
,
bool
IsStat
=
std
::
is_base_of
<
statically_typed_actor_base
,
T
>::
value
>
bool
IsStat
=
std
::
is_base_of
_v
<
statically_typed_actor_base
,
T
>
>
struct
implicit_actor_conversions
{
struct
implicit_actor_conversions
{
using
type
=
T
;
using
type
=
T
;
};
};
...
@@ -40,7 +40,7 @@ struct implicit_actor_conversions<actor_control_block, false, false> {
...
@@ -40,7 +40,7 @@ struct implicit_actor_conversions<actor_control_block, false, false> {
template
<
class
T
>
template
<
class
T
>
struct
implicit_conversions
{
struct
implicit_conversions
{
using
type
=
std
::
conditional_t
<
std
::
is_convertible
<
T
,
error
>::
value
,
error
,
using
type
=
std
::
conditional_t
<
std
::
is_convertible
_v
<
T
,
error
>
,
error
,
squash_if_int_t
<
T
>>
;
squash_if_int_t
<
T
>>
;
};
};
...
...
libcaf_core/caf/detail/init_fun_factory.hpp
View file @
8f94dc06
...
@@ -47,7 +47,7 @@ class init_fun_factory_helper final : public init_fun_factory_helper_base {
...
@@ -47,7 +47,7 @@ class init_fun_factory_helper final : public init_fun_factory_helper_base {
public:
public:
using
args_pointer
=
std
::
shared_ptr
<
Tuple
>
;
using
args_pointer
=
std
::
shared_ptr
<
Tuple
>
;
static
constexpr
bool
args_empty
=
std
::
tuple_size
<
Tuple
>::
value
==
0
;
static
constexpr
bool
args_empty
=
std
::
tuple_size
_v
<
Tuple
>
==
0
;
init_fun_factory_helper
(
F
fun
,
args_pointer
args
)
init_fun_factory_helper
(
F
fun
,
args_pointer
args
)
:
fun_
(
std
::
move
(
fun
)),
args_
(
std
::
move
(
args
))
{
:
fun_
(
std
::
move
(
fun
)),
args_
(
std
::
move
(
args
))
{
...
@@ -118,14 +118,14 @@ public:
...
@@ -118,14 +118,14 @@ public:
template
<
class
...
Ts
>
template
<
class
...
Ts
>
ptr_type
make
(
F
f
,
Ts
&&
...
xs
)
{
ptr_type
make
(
F
f
,
Ts
&&
...
xs
)
{
static_assert
(
std
::
is_base_of
<
local_actor
,
Base
>::
value
,
static_assert
(
std
::
is_base_of
_v
<
local_actor
,
Base
>
,
"Given Base does not extend local_actor"
);
"Given Base does not extend local_actor"
);
using
trait
=
typename
detail
::
get_callable_trait
<
F
>::
type
;
using
trait
=
typename
detail
::
get_callable_trait
<
F
>::
type
;
using
arg_types
=
typename
trait
::
arg_types
;
using
arg_types
=
typename
trait
::
arg_types
;
using
res_type
=
typename
trait
::
result_type
;
using
res_type
=
typename
trait
::
result_type
;
using
first_arg
=
typename
detail
::
tl_head
<
arg_types
>::
type
;
using
first_arg
=
typename
detail
::
tl_head
<
arg_types
>::
type
;
constexpr
bool
selfptr
=
std
::
is_pointer
<
first_arg
>::
value
;
constexpr
bool
selfptr
=
std
::
is_pointer
_v
<
first_arg
>
;
constexpr
bool
rets
=
std
::
is_convertible
<
res_type
,
behavior
>::
value
;
constexpr
bool
rets
=
std
::
is_convertible
_v
<
res_type
,
behavior
>
;
using
tuple_type
=
decltype
(
std
::
make_tuple
(
detail
::
spawn_fwd
<
Ts
>
(
xs
)...));
using
tuple_type
=
decltype
(
std
::
make_tuple
(
detail
::
spawn_fwd
<
Ts
>
(
xs
)...));
using
helper
=
init_fun_factory_helper
<
Base
,
F
,
tuple_type
,
rets
,
selfptr
>
;
using
helper
=
init_fun_factory_helper
<
Base
,
F
,
tuple_type
,
rets
,
selfptr
>
;
return
ptr_type
{
new
helper
{
std
::
move
(
f
),
sizeof
...(
Ts
)
>
0
return
ptr_type
{
new
helper
{
std
::
move
(
f
),
sizeof
...(
Ts
)
>
0
...
...
libcaf_core/caf/detail/parse.hpp
View file @
8f94dc06
...
@@ -72,7 +72,7 @@ CAF_CORE_EXPORT void parse(string_parser_state& ps, uint64_t& x);
...
@@ -72,7 +72,7 @@ CAF_CORE_EXPORT void parse(string_parser_state& ps, uint64_t& x);
// -- non-fixed size integer types ---------------------------------------------
// -- non-fixed size integer types ---------------------------------------------
template
<
class
T
>
template
<
class
T
>
detail
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
>
detail
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
>
parse
(
string_parser_state
&
ps
,
T
&
x
)
{
parse
(
string_parser_state
&
ps
,
T
&
x
)
{
using
squashed_type
=
squashed_int_t
<
T
>
;
using
squashed_type
=
squashed_int_t
<
T
>
;
return
parse
(
ps
,
reinterpret_cast
<
squashed_type
&>
(
x
));
return
parse
(
ps
,
reinterpret_cast
<
squashed_type
&>
(
x
));
...
...
libcaf_core/caf/detail/parser/read_signed_integer.hpp
View file @
8f94dc06
...
@@ -28,8 +28,7 @@ template <class State, class Consumer>
...
@@ -28,8 +28,7 @@ template <class State, class Consumer>
void
read_signed_integer
(
State
&
ps
,
Consumer
&&
consumer
)
{
void
read_signed_integer
(
State
&
ps
,
Consumer
&&
consumer
)
{
using
consumer_type
=
typename
std
::
decay
<
Consumer
>::
type
;
using
consumer_type
=
typename
std
::
decay
<
Consumer
>::
type
;
using
value_type
=
typename
consumer_type
::
value_type
;
using
value_type
=
typename
consumer_type
::
value_type
;
static_assert
(
std
::
is_integral
<
value_type
>::
value
static_assert
(
std
::
is_integral_v
<
value_type
>
&&
std
::
is_signed_v
<
value_type
>
,
&&
std
::
is_signed
<
value_type
>::
value
,
"expected a signed integer type"
);
"expected a signed integer type"
);
value_type
result
=
0
;
value_type
result
=
0
;
// Computes the result on success.
// Computes the result on success.
...
...
libcaf_core/caf/detail/parser/read_unsigned_integer.hpp
View file @
8f94dc06
...
@@ -28,8 +28,8 @@ template <class State, class Consumer>
...
@@ -28,8 +28,8 @@ template <class State, class Consumer>
void
read_unsigned_integer
(
State
&
ps
,
Consumer
&&
consumer
)
{
void
read_unsigned_integer
(
State
&
ps
,
Consumer
&&
consumer
)
{
using
consumer_type
=
typename
std
::
decay
<
Consumer
>::
type
;
using
consumer_type
=
typename
std
::
decay
<
Consumer
>::
type
;
using
value_type
=
typename
consumer_type
::
value_type
;
using
value_type
=
typename
consumer_type
::
value_type
;
static_assert
(
std
::
is_integral
<
value_type
>::
value
static_assert
(
std
::
is_integral
_v
<
value_type
>
&&
std
::
is_unsigned
<
value_type
>::
value
,
&&
std
::
is_unsigned
_v
<
value_type
>
,
"expected an unsigned integer type"
);
"expected an unsigned integer type"
);
value_type
result
=
0
;
value_type
result
=
0
;
// Computes the result on success.
// Computes the result on success.
...
...
libcaf_core/caf/detail/print.hpp
View file @
8f94dc06
...
@@ -128,12 +128,12 @@ void print(Buffer& buf, bool x) {
...
@@ -128,12 +128,12 @@ void print(Buffer& buf, bool x) {
}
}
template
<
class
Buffer
,
class
T
>
template
<
class
Buffer
,
class
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
>
print
(
Buffer
&
buf
,
T
x
)
{
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
>
print
(
Buffer
&
buf
,
T
x
)
{
// An integer can at most have 20 digits (UINT64_MAX).
// An integer can at most have 20 digits (UINT64_MAX).
char
stack_buffer
[
24
];
char
stack_buffer
[
24
];
char
*
p
=
stack_buffer
;
char
*
p
=
stack_buffer
;
// Convert negative values into positives as necessary.
// Convert negative values into positives as necessary.
if
constexpr
(
std
::
is_signed
<
T
>::
value
)
{
if
constexpr
(
std
::
is_signed
_v
<
T
>
)
{
if
(
x
==
std
::
numeric_limits
<
T
>::
min
())
{
if
(
x
==
std
::
numeric_limits
<
T
>::
min
())
{
using
namespace
std
::
literals
;
using
namespace
std
::
literals
;
// The code below would fail for the smallest value, because this value
// The code below would fail for the smallest value, because this value
...
@@ -172,7 +172,7 @@ std::enable_if_t<std::is_integral<T>::value> print(Buffer& buf, T x) {
...
@@ -172,7 +172,7 @@ std::enable_if_t<std::is_integral<T>::value> print(Buffer& buf, T x) {
}
}
template
<
class
Buffer
,
class
T
>
template
<
class
Buffer
,
class
T
>
std
::
enable_if_t
<
std
::
is_floating_point
<
T
>::
value
>
print
(
Buffer
&
buf
,
T
x
)
{
std
::
enable_if_t
<
std
::
is_floating_point
_v
<
T
>
>
print
(
Buffer
&
buf
,
T
x
)
{
// TODO: Check whether to_chars is available on supported compilers and
// TODO: Check whether to_chars is available on supported compilers and
// re-implement using the new API as soon as possible.
// re-implement using the new API as soon as possible.
auto
str
=
std
::
to_string
(
x
);
auto
str
=
std
::
to_string
(
x
);
...
...
libcaf_core/caf/detail/spawn_fwd.hpp
View file @
8f94dc06
...
@@ -40,7 +40,7 @@ typename std::conditional<
...
@@ -40,7 +40,7 @@ typename std::conditional<
spawn_fwd_convert
<
typename
std
::
remove_reference
<
T
>::
type
>::
value
,
actor
,
spawn_fwd_convert
<
typename
std
::
remove_reference
<
T
>::
type
>::
value
,
actor
,
T
&&>::
type
T
&&>::
type
spawn_fwd
(
typename
std
::
remove_reference
<
T
>::
type
&&
arg
)
noexcept
{
spawn_fwd
(
typename
std
::
remove_reference
<
T
>::
type
&&
arg
)
noexcept
{
static_assert
(
!
std
::
is_lvalue_reference
<
T
>::
value
,
static_assert
(
!
std
::
is_lvalue_reference
_v
<
T
>
,
"silently converting an lvalue to an rvalue"
);
"silently converting an lvalue to an rvalue"
);
return
static_cast
<
T
&&>
(
arg
);
return
static_cast
<
T
&&>
(
arg
);
}
}
...
...
libcaf_core/caf/detail/squashed_int.hpp
View file @
8f94dc06
...
@@ -42,7 +42,7 @@ struct int_types_by_size<8> {
...
@@ -42,7 +42,7 @@ struct int_types_by_size<8> {
template
<
class
T
>
template
<
class
T
>
struct
squashed_int
{
struct
squashed_int
{
using
tpair
=
int_types_by_size
<
sizeof
(
T
)
>
;
using
tpair
=
int_types_by_size
<
sizeof
(
T
)
>
;
using
type
=
std
::
conditional_t
<
std
::
is_signed
<
T
>::
value
,
//
using
type
=
std
::
conditional_t
<
std
::
is_signed
_v
<
T
>
,
//
typename
tpair
::
signed_type
,
//
typename
tpair
::
signed_type
,
//
typename
tpair
::
unsigned_type
>
;
typename
tpair
::
unsigned_type
>
;
};
};
...
@@ -50,7 +50,7 @@ struct squashed_int {
...
@@ -50,7 +50,7 @@ struct squashed_int {
template
<
class
T
>
template
<
class
T
>
using
squashed_int_t
=
typename
squashed_int
<
T
>::
type
;
using
squashed_int_t
=
typename
squashed_int
<
T
>::
type
;
template
<
class
T
,
bool
=
std
::
is_integral
<
T
>
::
value
>
template
<
class
T
,
bool
=
std
::
is_integral
_v
<
T
>
>
struct
squash_if_int
{
struct
squash_if_int
{
using
type
=
T
;
using
type
=
T
;
};
};
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
8f94dc06
...
@@ -90,8 +90,8 @@ public:
...
@@ -90,8 +90,8 @@ public:
bool
value
(
bool
x
);
bool
value
(
bool
x
);
template
<
class
Integral
>
template
<
class
Integral
>
std
::
enable_if_t
<
std
::
is_integral
<
Integral
>::
value
,
bool
>
value
(
Integral
x
)
{
std
::
enable_if_t
<
std
::
is_integral
_v
<
Integral
>
,
bool
>
value
(
Integral
x
)
{
if
constexpr
(
std
::
is_signed
<
Integral
>::
value
)
if
constexpr
(
std
::
is_signed
_v
<
Integral
>
)
return
int_value
(
static_cast
<
int64_t
>
(
x
));
return
int_value
(
static_cast
<
int64_t
>
(
x
));
else
else
return
int_value
(
static_cast
<
uint64_t
>
(
x
));
return
int_value
(
static_cast
<
uint64_t
>
(
x
));
...
@@ -151,9 +151,8 @@ public:
...
@@ -151,9 +151,8 @@ public:
}
}
template
<
class
T
>
template
<
class
T
>
std
::
enable_if_t
<
has_to_string
<
T
>::
value
std
::
enable_if_t
<
&&
!
std
::
is_convertible
<
T
,
std
::
string_view
>::
value
,
has_to_string_v
<
T
>
&&
!
std
::
is_convertible_v
<
T
,
std
::
string_view
>
,
bool
>
bool
>
builtin_inspect
(
const
T
&
x
)
{
builtin_inspect
(
const
T
&
x
)
{
auto
str
=
to_string
(
x
);
auto
str
=
to_string
(
x
);
if
constexpr
(
std
::
is_convertible
<
decltype
(
str
),
const
char
*>::
value
)
{
if
constexpr
(
std
::
is_convertible
<
decltype
(
str
),
const
char
*>::
value
)
{
...
@@ -220,8 +219,8 @@ public:
...
@@ -220,8 +219,8 @@ public:
static
std
::
string
render
(
const
T
&
x
)
{
static
std
::
string
render
(
const
T
&
x
)
{
if
constexpr
(
std
::
is_same_v
<
std
::
nullptr_t
,
T
>
)
{
if
constexpr
(
std
::
is_same_v
<
std
::
nullptr_t
,
T
>
)
{
return
"null"
;
return
"null"
;
}
else
if
constexpr
(
std
::
is_constructible
<
std
::
string_view
,
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_constructible
_v
<
std
::
string_view
,
T
>
)
{
if
constexpr
(
std
::
is_pointer
<
T
>::
value
)
{
if
constexpr
(
std
::
is_pointer
_v
<
T
>
)
{
if
(
x
==
nullptr
)
if
(
x
==
nullptr
)
return
"null"
;
return
"null"
;
}
}
...
...
libcaf_core/caf/detail/type_list.hpp
View file @
8f94dc06
...
@@ -45,9 +45,9 @@ struct is_type_list<type_list<Ts...>> {
...
@@ -45,9 +45,9 @@ struct is_type_list<type_list<Ts...>> {
static
constexpr
bool
value
=
true
;
static
constexpr
bool
value
=
true
;
};
};
//
Uncomment after having switched to C++14
//
/ Convenience alias for `is_type_list<T>::value`.
//
template <class T>
template
<
class
T
>
//
inline constexpr bool is_type_list_v = is_type_list<T>::value;
inline
constexpr
bool
is_type_list_v
=
is_type_list
<
T
>::
value
;
// T head(type_list)
// T head(type_list)
...
@@ -101,9 +101,9 @@ struct tl_size<type_list<Ts...>> {
...
@@ -101,9 +101,9 @@ struct tl_size<type_list<Ts...>> {
template
<
class
...
Ts
>
template
<
class
...
Ts
>
constexpr
size_t
tl_size
<
type_list
<
Ts
...
>>::
value
;
constexpr
size_t
tl_size
<
type_list
<
Ts
...
>>::
value
;
//
Uncomment after having switched to C++14
//
/ Convenience alias for `tl_size<List>::value`.
//
template <class List>
template
<
class
List
>
//
inline constexpr size_t tl_size_v = tl_size<List>::value;
inline
constexpr
size_t
tl_size_v
=
tl_size
<
List
>::
value
;
// T back(type_list)
// T back(type_list)
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
8f94dc06
...
@@ -34,7 +34,9 @@
...
@@ -34,7 +34,9 @@
\
\
public: \
public: \
static constexpr bool value = sfinae_type::value; \
static constexpr bool value = sfinae_type::value; \
}
}; \
template <class T> \
constexpr bool has_##name##_member_v = has_##name##_member<T>::value
#define CAF_HAS_ALIAS_TRAIT(name) \
#define CAF_HAS_ALIAS_TRAIT(name) \
template <class T> \
template <class T> \
...
@@ -88,9 +90,14 @@ private:
...
@@ -88,9 +90,14 @@ private:
using
result
=
decltype
(
sfinae
(
std
::
declval
<
const
T
&>
()));
using
result
=
decltype
(
sfinae
(
std
::
declval
<
const
T
&>
()));
public:
public:
static
constexpr
bool
value
=
std
::
is_convertible
<
result
,
std
::
string
>::
value
;
static
constexpr
bool
value
=
std
::
is_convertible
_v
<
result
,
std
::
string
>
;
};
};
/// Convenience alias for `has_to_string<T>::value`.
/// @relates has_to_string
template
<
class
T
>
inline
constexpr
bool
has_to_string_v
=
has_to_string
<
T
>::
value
;
template
<
bool
X
>
template
<
bool
X
>
using
bool_token
=
std
::
integral_constant
<
bool
,
X
>
;
using
bool_token
=
std
::
integral_constant
<
bool
,
X
>
;
...
@@ -136,10 +143,10 @@ struct is_duration<std::chrono::duration<Period, Rep>> : std::true_type {};
...
@@ -136,10 +143,10 @@ struct is_duration<std::chrono::duration<Period, Rep>> : std::true_type {};
/// convertible to one of STL's string types.
/// convertible to one of STL's string types.
template
<
class
T
>
template
<
class
T
>
struct
is_primitive
{
struct
is_primitive
{
static
constexpr
bool
value
=
std
::
is_convertible
<
T
,
std
::
string
>::
value
static
constexpr
bool
value
=
std
::
is_convertible
_v
<
T
,
std
::
string
>
||
std
::
is_convertible
<
T
,
std
::
u16string
>::
value
||
std
::
is_convertible
_v
<
T
,
std
::
u16string
>
||
std
::
is_convertible
<
T
,
std
::
u32string
>::
value
||
std
::
is_convertible
_v
<
T
,
std
::
u32string
>
||
std
::
is_arithmetic
<
T
>::
value
;
||
std
::
is_arithmetic
_v
<
T
>
;
};
};
/// Checks whether `T1` is comparable with `T2`.
/// Checks whether `T1` is comparable with `T2`.
...
@@ -168,15 +175,16 @@ class is_comparable {
...
@@ -168,15 +175,16 @@ class is_comparable {
using
result_type
=
decltype
(
cmp_help_fun
(
using
result_type
=
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
bool
*>
(
nullptr
),
static_cast
<
bool
*>
(
nullptr
),
std
::
integral_constant
<
bool
,
std
::
is_arithmetic
<
T1
>::
value
std
::
integral_constant
<
bool
,
std
::
is_arithmetic
_v
<
T1
>
&&
std
::
is_arithmetic
<
T2
>::
value
>
{}));
&&
std
::
is_arithmetic
_v
<
T2
>
>
{}));
public:
public:
static
constexpr
bool
value
=
std
::
is_same_v
<
bool
,
result_type
>
;
static
constexpr
bool
value
=
std
::
is_same_v
<
bool
,
result_type
>
;
};
};
/// Convenience alias for `is_comparable<T1, T2>::value`.
template
<
class
T1
,
class
T2
>
template
<
class
T1
,
class
T2
>
constexpr
bool
is_comparable_v
=
is_comparable
<
T1
,
T2
>::
value
;
inline
constexpr
bool
is_comparable_v
=
is_comparable
<
T1
,
T2
>::
value
;
/// Checks whether `T` behaves like a forward iterator.
/// Checks whether `T` behaves like a forward iterator.
template
<
class
T
>
template
<
class
T
>
...
@@ -319,9 +327,9 @@ struct has_apply_operator {
...
@@ -319,9 +327,9 @@ struct has_apply_operator {
// matches (IsFun || IsMemberFun)
// matches (IsFun || IsMemberFun)
template
<
class
T
,
template
<
class
T
,
bool
IsFun
bool
IsFun
=
std
::
is_function
<
T
>
::
value
=
std
::
is_function
_v
<
T
>
||
std
::
is_function
<
typename
std
::
remove_pointer
<
T
>::
type
>::
value
||
std
::
is_function
<
typename
std
::
remove_pointer
<
T
>::
type
>::
value
||
std
::
is_member_function_pointer
<
T
>::
value
,
||
std
::
is_member_function_pointer
_v
<
T
>
,
bool
HasApplyOp
=
has_apply_operator
<
T
>::
value
>
bool
HasApplyOp
=
has_apply_operator
<
T
>::
value
>
struct
get_callable_trait_helper
{
struct
get_callable_trait_helper
{
using
type
=
callable_trait
<
T
>
;
using
type
=
callable_trait
<
T
>
;
...
@@ -369,6 +377,11 @@ public:
...
@@ -369,6 +377,11 @@ public:
static
constexpr
bool
value
=
std
::
is_same_v
<
bool
,
result_type
>
;
static
constexpr
bool
value
=
std
::
is_same_v
<
bool
,
result_type
>
;
};
};
/// Convenience alias for `is_callable<T>::value`.
/// @relates is_callable
template
<
class
T
>
inline
constexpr
bool
is_callable_v
=
is_callable
<
T
>::
value
;
/// Checks whether `F` is callable with arguments of types `Ts...`.
/// Checks whether `F` is callable with arguments of types `Ts...`.
template
<
class
F
,
class
...
Ts
>
template
<
class
F
,
class
...
Ts
>
struct
is_callable_with
{
struct
is_callable_with
{
...
@@ -409,7 +422,7 @@ struct type_at<0, T0, Ts...> {
...
@@ -409,7 +422,7 @@ struct type_at<0, T0, Ts...> {
};
};
// Checks whether T has a member variable named `name`.
// Checks whether T has a member variable named `name`.
template
<
class
T
,
bool
IsScalar
=
std
::
is_scalar
<
T
>
::
value
>
template
<
class
T
,
bool
IsScalar
=
std
::
is_scalar
_v
<
T
>
>
class
has_name
{
class
has_name
{
private:
private:
// a simple struct with a member called `name`
// a simple struct with a member called `name`
...
@@ -449,10 +462,14 @@ CAF_HAS_MEMBER_TRAIT(size);
...
@@ -449,10 +462,14 @@ CAF_HAS_MEMBER_TRAIT(size);
template
<
class
F
,
class
T
>
template
<
class
F
,
class
T
>
struct
is_handler_for
{
struct
is_handler_for
{
static
constexpr
bool
value
static
constexpr
bool
value
=
std
::
is_convertible
<
F
,
std
::
function
<
void
(
T
&
)
>>::
value
=
std
::
is_convertible
_v
<
F
,
std
::
function
<
void
(
T
&
)
>>
||
std
::
is_convertible
<
F
,
std
::
function
<
void
(
const
T
&
)
>>::
value
;
||
std
::
is_convertible
_v
<
F
,
std
::
function
<
void
(
const
T
&
)
>>
;
};
};
/// Convenience alias for `is_handler_for<F, T>::value`.
template
<
class
F
,
class
T
>
inline
constexpr
bool
is_handler_for_v
=
is_handler_for
<
F
,
T
>::
value
;
template
<
class
T
>
template
<
class
T
>
struct
value_type_of
{
struct
value_type_of
{
using
type
=
typename
T
::
value_type
;
using
type
=
typename
T
::
value_type
;
...
@@ -467,11 +484,10 @@ template <class T>
...
@@ -467,11 +484,10 @@ template <class T>
using
value_type_of_t
=
typename
value_type_of
<
T
>::
type
;
using
value_type_of_t
=
typename
value_type_of
<
T
>::
type
;
template
<
class
T
>
template
<
class
T
>
using
is_callable_t
=
typename
std
::
enable_if
<
is_callable
<
T
>::
value
>::
type
;
using
is_callable_t
=
typename
std
::
enable_if
<
is_callable
_v
<
T
>
>::
type
;
template
<
class
F
,
class
T
>
template
<
class
F
,
class
T
>
using
is_handler_for_ef
=
using
is_handler_for_ef
=
typename
std
::
enable_if
<
is_handler_for_v
<
F
,
T
>>::
type
;
typename
std
::
enable_if
<
is_handler_for
<
F
,
T
>::
value
>::
type
;
template
<
class
T
>
template
<
class
T
>
struct
strip_reference_wrapper
{
struct
strip_reference_wrapper
{
...
@@ -540,15 +556,14 @@ constexpr bool is_expected_v = is_expected<T>::value;
...
@@ -540,15 +556,14 @@ constexpr bool is_expected_v = is_expected<T>::value;
// Checks whether `T` and `U` are integers of the same size and signedness.
// Checks whether `T` and `U` are integers of the same size and signedness.
// clang-format off
// clang-format off
template
<
class
T
,
class
U
,
template
<
class
T
,
class
U
,
bool
Enable
=
std
::
is_integral
<
T
>
::
value
bool
Enable
=
std
::
is_integral
_v
<
T
>
&&
std
::
is_integral
<
U
>::
value
&&
std
::
is_integral
_v
<
U
>
&&
!
std
::
is_same_v
<
T
,
bool
>
&&
!
std
::
is_same_v
<
T
,
bool
>
&&
!
std
::
is_same_v
<
U
,
bool
>>
&&
!
std
::
is_same_v
<
U
,
bool
>>
// clang-format on
// clang-format on
struct
is_equal_int_type
{
struct
is_equal_int_type
{
static
constexpr
bool
value
=
sizeof
(
T
)
==
sizeof
(
U
)
static
constexpr
bool
value
=
sizeof
(
T
)
==
sizeof
(
U
)
&&
std
::
is_signed
<
T
>::
value
&&
std
::
is_signed_v
<
T
>
==
std
::
is_signed_v
<
U
>
;
==
std
::
is_signed
<
U
>::
value
;
};
};
template
<
class
T
,
typename
U
>
template
<
class
T
,
typename
U
>
...
@@ -612,10 +627,14 @@ struct all_constructible<type_list<>, type_list<>> : std::true_type {};
...
@@ -612,10 +627,14 @@ struct all_constructible<type_list<>, type_list<>> : std::true_type {};
template
<
class
T
,
class
...
Ts
,
class
U
,
class
...
Us
>
template
<
class
T
,
class
...
Ts
,
class
U
,
class
...
Us
>
struct
all_constructible
<
type_list
<
T
,
Ts
...
>
,
type_list
<
U
,
Us
...
>>
{
struct
all_constructible
<
type_list
<
T
,
Ts
...
>
,
type_list
<
U
,
Us
...
>>
{
static
constexpr
bool
value
static
constexpr
bool
value
=
std
::
is_constructible
<
T
,
U
>::
value
=
std
::
is_constructible
_v
<
T
,
U
>
&&
all_constructible
<
type_list
<
Ts
...
>
,
type_list
<
Us
...
>>::
value
;
&&
all_constructible
<
type_list
<
Ts
...
>
,
type_list
<
Us
...
>>::
value
;
};
};
/// Convenience alias for `all_constructible<Ts, Us>::value`.
template
<
class
Ts
,
class
Us
>
inline
constexpr
bool
all_constructible_v
=
all_constructible
<
Ts
,
Us
>::
value
;
/// Checks whether T behaves like `std::map`.
/// Checks whether T behaves like `std::map`.
template
<
class
T
>
template
<
class
T
>
struct
is_map_like
{
struct
is_map_like
{
...
@@ -808,8 +827,9 @@ template <class T, class To>
...
@@ -808,8 +827,9 @@ template <class T, class To>
class
has_convertible_data_member
{
class
has_convertible_data_member
{
private:
private:
template
<
class
U
>
template
<
class
U
>
static
auto
sfinae
(
U
*
x
)
->
std
::
integral_constant
<
static
auto
sfinae
(
U
*
x
)
bool
,
std
::
is_convertible
<
decltype
(
x
->
data
()),
To
*>::
value
>
;
->
std
::
integral_constant
<
bool
,
std
::
is_convertible_v
<
decltype
(
x
->
data
()),
To
*>>
;
template
<
class
U
>
template
<
class
U
>
static
auto
sfinae
(...)
->
std
::
false_type
;
static
auto
sfinae
(...)
->
std
::
false_type
;
...
@@ -917,7 +937,7 @@ struct is_trivial_inspector_value<true, T> {
...
@@ -917,7 +937,7 @@ struct is_trivial_inspector_value<true, T> {
template
<
class
T
>
template
<
class
T
>
struct
is_trivial_inspector_value
<
false
,
T
>
{
struct
is_trivial_inspector_value
<
false
,
T
>
{
static
constexpr
bool
value
=
std
::
is_convertible
<
T
,
std
::
string_view
>::
value
;
static
constexpr
bool
value
=
std
::
is_convertible
_v
<
T
,
std
::
string_view
>
;
};
};
#define CAF_ADD_TRIVIAL_LOAD_INSPECTOR_VALUE(type) \
#define CAF_ADD_TRIVIAL_LOAD_INSPECTOR_VALUE(type) \
...
@@ -973,11 +993,16 @@ public:
...
@@ -973,11 +993,16 @@ public:
static
constexpr
bool
value
=
sfinae_result
::
value
;
static
constexpr
bool
value
=
sfinae_result
::
value
;
};
};
/// Convenience alias for `accepts_opaque_value<Inspector, T>::value`.
template
<
class
Inspector
,
class
T
>
inline
constexpr
bool
accepts_opaque_value_v
=
accepts_opaque_value
<
Inspector
,
T
>::
value
;
/// Checks whether `T` is primitive, i.e., either an arithmetic type or
/// Checks whether `T` is primitive, i.e., either an arithmetic type or
/// convertible to one of STL's string types.
/// convertible to one of STL's string types.
template
<
class
T
,
bool
IsLoading
>
template
<
class
T
,
bool
IsLoading
>
struct
is_builtin_inspector_type
{
struct
is_builtin_inspector_type
{
static
constexpr
bool
value
=
std
::
is_arithmetic
<
T
>::
value
;
static
constexpr
bool
value
=
std
::
is_arithmetic
_v
<
T
>
;
};
};
template
<
bool
IsLoading
>
template
<
bool
IsLoading
>
...
...
libcaf_core/caf/detail/typed_actor_util.hpp
View file @
8f94dc06
...
@@ -125,9 +125,8 @@ struct is_normalized_signature {
...
@@ -125,9 +125,8 @@ struct is_normalized_signature {
};
};
template
<
class
T
>
template
<
class
T
>
constexpr
bool
is_decayed
=
!
std
::
is_reference
<
T
>::
value
inline
constexpr
bool
is_decayed
&&
!
std
::
is_const
<
T
>::
value
=
!
std
::
is_reference_v
<
T
>
&&
!
std
::
is_const_v
<
T
>
&&
!
std
::
is_volatile_v
<
T
>
;
&&
!
std
::
is_volatile
<
T
>::
value
;
template
<
class
...
Out
,
class
...
In
>
template
<
class
...
Out
,
class
...
In
>
struct
is_normalized_signature
<
result
<
Out
...
>
(
In
...)
>
{
struct
is_normalized_signature
<
result
<
Out
...
>
(
In
...)
>
{
...
...
libcaf_core/caf/detail/unique_function.hpp
View file @
8f94dc06
...
@@ -85,7 +85,7 @@ public:
...
@@ -85,7 +85,7 @@ public:
template
<
template
<
class
T
,
class
T
,
class
=
typename
std
::
enable_if
<
class
=
typename
std
::
enable_if
<
!
std
::
is_convertible
<
T
,
raw_pointer
>
::
value
!
std
::
is_convertible
_v
<
T
,
raw_pointer
>
&&
std
::
is_same
<
decltype
((
std
::
declval
<
T
&>
())(
std
::
declval
<
Ts
>
()...)),
&&
std
::
is_same
<
decltype
((
std
::
declval
<
T
&>
())(
std
::
declval
<
Ts
>
()...)),
R
>::
value
>::
type
>
R
>::
value
>::
type
>
explicit
unique_function
(
T
f
)
:
unique_function
(
make_wrapper
(
std
::
move
(
f
)))
{
explicit
unique_function
(
T
f
)
:
unique_function
(
make_wrapper
(
std
::
move
(
f
)))
{
...
@@ -129,7 +129,7 @@ public:
...
@@ -129,7 +129,7 @@ public:
template
<
class
Fn
>
template
<
class
Fn
>
void
emplace
(
Fn
fn
)
{
void
emplace
(
Fn
fn
)
{
destroy
();
destroy
();
if
constexpr
(
std
::
is_convertible
<
Fn
,
raw_pointer
>::
value
)
{
if
constexpr
(
std
::
is_convertible
_v
<
Fn
,
raw_pointer
>
)
{
holds_wrapper_
=
false
;
holds_wrapper_
=
false
;
fptr_
=
fn
;
fptr_
=
fn
;
}
else
{
}
else
{
...
...
libcaf_core/caf/exec_main.hpp
View file @
8f94dc06
...
@@ -37,7 +37,7 @@ struct exec_main_helper<detail::type_list<actor_system&, const T&>> {
...
@@ -37,7 +37,7 @@ struct exec_main_helper<detail::type_list<actor_system&, const T&>> {
template
<
class
T
>
template
<
class
T
>
void
exec_main_init_meta_objects_single
()
{
void
exec_main_init_meta_objects_single
()
{
if
constexpr
(
std
::
is_base_of
<
actor_system
::
module
,
T
>::
value
)
if
constexpr
(
std
::
is_base_of
_v
<
actor_system
::
module
,
T
>
)
T
::
init_global_meta_objects
();
T
::
init_global_meta_objects
();
else
else
init_global_meta_objects
<
T
>
();
init_global_meta_objects
<
T
>
();
...
@@ -50,7 +50,7 @@ void exec_main_init_meta_objects() {
...
@@ -50,7 +50,7 @@ void exec_main_init_meta_objects() {
template
<
class
T
>
template
<
class
T
>
void
exec_main_load_module
(
actor_system_config
&
cfg
)
{
void
exec_main_load_module
(
actor_system_config
&
cfg
)
{
if
constexpr
(
std
::
is_base_of
<
actor_system
::
module
,
T
>::
value
)
if
constexpr
(
std
::
is_base_of
_v
<
actor_system
::
module
,
T
>
)
cfg
.
template
load
<
T
>();
cfg
.
template
load
<
T
>();
}
}
...
@@ -67,7 +67,7 @@ int exec_main(F fun, int argc, char** argv) {
...
@@ -67,7 +67,7 @@ int exec_main(F fun, int argc, char** argv) {
using
arg2
=
typename
detail
::
tl_at
<
arg_types
,
1
>::
type
;
using
arg2
=
typename
detail
::
tl_at
<
arg_types
,
1
>::
type
;
using
decayed_arg2
=
typename
std
::
decay
<
arg2
>::
type
;
using
decayed_arg2
=
typename
std
::
decay
<
arg2
>::
type
;
static_assert
(
std
::
is_same_v
<
arg2
,
unit_t
>
static_assert
(
std
::
is_same_v
<
arg2
,
unit_t
>
||
(
std
::
is_base_of
<
actor_system_config
,
decayed_arg2
>::
value
||
(
std
::
is_base_of
_v
<
actor_system_config
,
decayed_arg2
>
&&
std
::
is_same
<
arg2
,
const
decayed_arg2
&>::
value
),
&&
std
::
is_same
<
arg2
,
const
decayed_arg2
&>::
value
),
"second parameter of main function must take a subtype of "
"second parameter of main function must take a subtype of "
"actor_system_config as const reference"
);
"actor_system_config as const reference"
);
...
@@ -95,7 +95,7 @@ int exec_main(F fun, int argc, char** argv) {
...
@@ -95,7 +95,7 @@ int exec_main(F fun, int argc, char** argv) {
}
}
helper
f
;
helper
f
;
using
result_type
=
decltype
(
f
(
fun
,
system
,
cfg
));
using
result_type
=
decltype
(
f
(
fun
,
system
,
cfg
));
if
constexpr
(
std
::
is_convertible
<
result_type
,
int
>::
value
)
{
if
constexpr
(
std
::
is_convertible
_v
<
result_type
,
int
>
)
{
return
f
(
fun
,
system
,
cfg
);
return
f
(
fun
,
system
,
cfg
);
}
else
{
}
else
{
f
(
fun
,
system
,
cfg
);
f
(
fun
,
system
,
cfg
);
...
...
libcaf_core/caf/expected.hpp
View file @
8f94dc06
...
@@ -53,14 +53,12 @@ public:
...
@@ -53,14 +53,12 @@ public:
// -- static member variables ------------------------------------------------
// -- static member variables ------------------------------------------------
/// Stores whether move construct and move assign never throw.
/// Stores whether move construct and move assign never throw.
static
constexpr
bool
nothrow_move
static
constexpr
bool
nothrow_move
=
std
::
is_nothrow_move_constructible_v
<
T
>
=
std
::
is_nothrow_move_constructible
<
T
>::
value
&&
std
::
is_nothrow_move_assignable_v
<
T
>
;
&&
std
::
is_nothrow_move_assignable
<
T
>::
value
;
/// Stores whether copy construct and copy assign never throw.
/// Stores whether copy construct and copy assign never throw.
static
constexpr
bool
nothrow_copy
static
constexpr
bool
nothrow_copy
=
std
::
is_nothrow_copy_constructible_v
<
T
>
=
std
::
is_nothrow_copy_constructible
<
T
>::
value
&&
std
::
is_nothrow_copy_assignable_v
<
T
>
;
&&
std
::
is_nothrow_copy_assignable
<
T
>::
value
;
/// Stores whether swap() never throws.
/// Stores whether swap() never throws.
static
constexpr
bool
nothrow_swap
=
std
::
is_nothrow_swappable_v
<
T
>
;
static
constexpr
bool
nothrow_swap
=
std
::
is_nothrow_swappable_v
<
T
>
;
...
@@ -155,7 +153,7 @@ public:
...
@@ -155,7 +153,7 @@ public:
}
}
template
<
class
U
>
template
<
class
U
>
typename
std
::
enable_if
<
std
::
is_convertible
<
U
,
T
>::
value
,
expected
&>::
type
typename
std
::
enable_if
<
std
::
is_convertible
_v
<
U
,
T
>
,
expected
&>::
type
operator
=
(
U
x
)
{
operator
=
(
U
x
)
{
return
*
this
=
T
{
std
::
move
(
x
)};
return
*
this
=
T
{
std
::
move
(
x
)};
}
}
...
...
libcaf_core/caf/hash/fnv.hpp
View file @
8f94dc06
...
@@ -105,7 +105,7 @@ public:
...
@@ -105,7 +105,7 @@ public:
}
}
template
<
class
Integral
>
template
<
class
Integral
>
std
::
enable_if_t
<
std
::
is_integral
<
Integral
>::
value
,
bool
>
std
::
enable_if_t
<
std
::
is_integral
_v
<
Integral
>
,
bool
>
value
(
Integral
x
)
noexcept
{
value
(
Integral
x
)
noexcept
{
auto
begin
=
reinterpret_cast
<
const
uint8_t
*>
(
&
x
);
auto
begin
=
reinterpret_cast
<
const
uint8_t
*>
(
&
x
);
append
(
begin
,
begin
+
sizeof
(
Integral
));
append
(
begin
,
begin
+
sizeof
(
Integral
));
...
...
libcaf_core/caf/hash/sha1.hpp
View file @
8f94dc06
...
@@ -100,7 +100,7 @@ public:
...
@@ -100,7 +100,7 @@ public:
}
}
template
<
class
Integral
>
template
<
class
Integral
>
std
::
enable_if_t
<
std
::
is_integral
<
Integral
>::
value
,
bool
>
std
::
enable_if_t
<
std
::
is_integral
_v
<
Integral
>
,
bool
>
value
(
Integral
x
)
noexcept
{
value
(
Integral
x
)
noexcept
{
auto
begin
=
reinterpret_cast
<
const
uint8_t
*>
(
&
x
);
auto
begin
=
reinterpret_cast
<
const
uint8_t
*>
(
&
x
);
append
(
begin
,
begin
+
sizeof
(
Integral
));
append
(
begin
,
begin
+
sizeof
(
Integral
));
...
...
libcaf_core/caf/infer_handle.hpp
View file @
8f94dc06
...
@@ -66,8 +66,8 @@ struct infer_handle_from_fun_impl<typed_behavior<Sigs...>, Impl, false> {
...
@@ -66,8 +66,8 @@ struct infer_handle_from_fun_impl<typed_behavior<Sigs...>, Impl, false> {
// statically typed actor with self pointer
// statically typed actor with self pointer
template
<
class
...
Sigs
,
class
Impl
>
template
<
class
...
Sigs
,
class
Impl
>
struct
infer_handle_from_fun_impl
<
typed_behavior
<
Sigs
...
>
,
Impl
*
,
true
>
{
struct
infer_handle_from_fun_impl
<
typed_behavior
<
Sigs
...
>
,
Impl
*
,
true
>
{
static_assert
(
std
::
is_base_of
<
typed_event_based_actor
<
Sigs
...
>
,
Impl
>::
value
static_assert
(
std
::
is_base_of
_v
<
typed_event_based_actor
<
Sigs
...
>
,
Impl
>
||
std
::
is_base_of
<
io
::
typed_broker
<
Sigs
...
>
,
Impl
>::
value
,
||
std
::
is_base_of
_v
<
io
::
typed_broker
<
Sigs
...
>
,
Impl
>
,
"Self pointer does not match the returned behavior type."
);
"Self pointer does not match the returned behavior type."
);
using
type
=
typed_actor
<
Sigs
...
>
;
using
type
=
typed_actor
<
Sigs
...
>
;
using
impl
=
Impl
;
using
impl
=
Impl
;
...
@@ -109,7 +109,7 @@ struct infer_handle_from_behavior<typed_behavior<Sigs...>> {
...
@@ -109,7 +109,7 @@ struct infer_handle_from_behavior<typed_behavior<Sigs...>> {
/// Deduces `actor` for dynamically typed actors, otherwise `typed_actor<...>`
/// Deduces `actor` for dynamically typed actors, otherwise `typed_actor<...>`
/// is deduced.
/// is deduced.
template
<
class
T
,
bool
=
std
::
is_base_of
<
abstract_actor
,
T
>
::
value
>
template
<
class
T
,
bool
=
std
::
is_base_of
_v
<
abstract_actor
,
T
>
>
struct
infer_handle_from_class
{
struct
infer_handle_from_class
{
using
type
=
using
type
=
typename
infer_handle_from_behavior
<
typename
T
::
behavior_type
>::
type
;
typename
infer_handle_from_behavior
<
typename
T
::
behavior_type
>::
type
;
...
@@ -137,4 +137,8 @@ struct is_handle<strong_actor_ptr> : std::true_type {};
...
@@ -137,4 +137,8 @@ struct is_handle<strong_actor_ptr> : std::true_type {};
template
<
class
...
Ts
>
template
<
class
...
Ts
>
struct
is_handle
<
typed_actor
<
Ts
...
>>
:
std
::
true_type
{};
struct
is_handle
<
typed_actor
<
Ts
...
>>
:
std
::
true_type
{};
/// Convenience alias for `is_handle<T>::value`.
template
<
class
T
>
inline
constexpr
bool
is_handle_v
=
is_handle
<
T
>::
value
;
}
// namespace caf
}
// namespace caf
libcaf_core/caf/inspector_access.hpp
View file @
8f94dc06
...
@@ -126,13 +126,13 @@ bool load(Inspector& f, T& x, inspector_access_type::list) {
...
@@ -126,13 +126,13 @@ bool load(Inspector& f, T& x, inspector_access_type::list) {
}
}
template
<
class
Inspector
,
class
T
>
template
<
class
Inspector
,
class
T
>
std
::
enable_if_t
<
accepts_opaque_value
<
Inspector
,
T
>::
value
,
bool
>
std
::
enable_if_t
<
accepts_opaque_value
_v
<
Inspector
,
T
>
,
bool
>
load
(
Inspector
&
f
,
T
&
x
,
inspector_access_type
::
none
)
{
load
(
Inspector
&
f
,
T
&
x
,
inspector_access_type
::
none
)
{
return
f
.
opaque_value
(
x
);
return
f
.
opaque_value
(
x
);
}
}
template
<
class
Inspector
,
class
T
>
template
<
class
Inspector
,
class
T
>
std
::
enable_if_t
<!
accepts_opaque_value
<
Inspector
,
T
>::
value
,
bool
>
std
::
enable_if_t
<!
accepts_opaque_value
_v
<
Inspector
,
T
>
,
bool
>
load
(
Inspector
&
,
T
&
,
inspector_access_type
::
none
)
{
load
(
Inspector
&
,
T
&
,
inspector_access_type
::
none
)
{
static_assert
(
static_assert
(
detail
::
assertion_failed_v
<
T
>
,
detail
::
assertion_failed_v
<
T
>
,
...
@@ -219,13 +219,13 @@ bool save(Inspector& f, T& x, inspector_access_type::list) {
...
@@ -219,13 +219,13 @@ bool save(Inspector& f, T& x, inspector_access_type::list) {
}
}
template
<
class
Inspector
,
class
T
>
template
<
class
Inspector
,
class
T
>
std
::
enable_if_t
<
accepts_opaque_value
<
Inspector
,
T
>::
value
,
bool
>
std
::
enable_if_t
<
accepts_opaque_value
_v
<
Inspector
,
T
>
,
bool
>
save
(
Inspector
&
f
,
T
&
x
,
inspector_access_type
::
none
)
{
save
(
Inspector
&
f
,
T
&
x
,
inspector_access_type
::
none
)
{
return
f
.
opaque_value
(
x
);
return
f
.
opaque_value
(
x
);
}
}
template
<
class
Inspector
,
class
T
>
template
<
class
Inspector
,
class
T
>
std
::
enable_if_t
<!
accepts_opaque_value
<
Inspector
,
T
>::
value
,
bool
>
std
::
enable_if_t
<!
accepts_opaque_value
_v
<
Inspector
,
T
>
,
bool
>
save
(
Inspector
&
,
T
&
,
inspector_access_type
::
none
)
{
save
(
Inspector
&
,
T
&
,
inspector_access_type
::
none
)
{
static_assert
(
static_assert
(
detail
::
assertion_failed_v
<
T
>
,
detail
::
assertion_failed_v
<
T
>
,
...
@@ -240,7 +240,7 @@ bool save(Inspector& f, T& x) {
...
@@ -240,7 +240,7 @@ bool save(Inspector& f, T& x) {
template
<
class
Inspector
,
class
T
>
template
<
class
Inspector
,
class
T
>
bool
save
(
Inspector
&
f
,
const
T
&
x
)
{
bool
save
(
Inspector
&
f
,
const
T
&
x
)
{
if
constexpr
(
!
std
::
is_function
<
T
>::
value
)
{
if
constexpr
(
!
std
::
is_function
_v
<
T
>
)
{
return
save
(
f
,
as_mutable_ref
(
x
),
inspect_access_type
<
Inspector
,
T
>
());
return
save
(
f
,
as_mutable_ref
(
x
),
inspect_access_type
<
Inspector
,
T
>
());
}
else
{
}
else
{
// Only inspector such as the stringification_inspector are going to accept
// Only inspector such as the stringification_inspector are going to accept
...
...
libcaf_core/caf/intrusive/forward_iterator.hpp
View file @
8f94dc06
...
@@ -28,9 +28,9 @@ public:
...
@@ -28,9 +28,9 @@ public:
using
const_reference
=
const
value_type
&
;
using
const_reference
=
const
value_type
&
;
using
node_type
=
typename
std
::
conditional
<
std
::
is_const
<
T
>::
value
,
using
node_type
=
const
typename
T
::
node_type
,
typename
std
::
conditional_t
<
std
::
is_const_v
<
T
>
,
const
typename
T
::
node_type
,
typename
T
::
node_type
>::
type
;
typename
T
::
node_type
>
;
using
node_pointer
=
node_type
*
;
using
node_pointer
=
node_type
*
;
...
...
libcaf_core/caf/intrusive_ptr.hpp
View file @
8f94dc06
...
@@ -87,8 +87,7 @@ public:
...
@@ -87,8 +87,7 @@ public:
template
<
class
Y
>
template
<
class
Y
>
intrusive_ptr
(
intrusive_ptr
<
Y
>
other
)
noexcept
:
ptr_
(
other
.
detach
())
{
intrusive_ptr
(
intrusive_ptr
<
Y
>
other
)
noexcept
:
ptr_
(
other
.
detach
())
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
static_assert
(
std
::
is_convertible_v
<
Y
*
,
T
*>
,
"Y* is not assignable to T*"
);
"Y* is not assignable to T*"
);
}
}
~
intrusive_ptr
()
{
~
intrusive_ptr
()
{
...
@@ -262,14 +261,14 @@ operator!=(const T* lhs, const intrusive_ptr<U>& rhs) {
...
@@ -262,14 +261,14 @@ operator!=(const T* lhs, const intrusive_ptr<U>& rhs) {
/// @relates intrusive_ptr
/// @relates intrusive_ptr
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
detail
::
enable_if_t
<
detail
::
is_comparable
<
T
*
,
U
*>::
value
,
bool
>
detail
::
enable_if_t
<
detail
::
is_comparable
_v
<
T
*
,
U
*>
,
bool
>
operator
==
(
const
intrusive_ptr
<
T
>&
x
,
const
intrusive_ptr
<
U
>&
y
)
{
operator
==
(
const
intrusive_ptr
<
T
>&
x
,
const
intrusive_ptr
<
U
>&
y
)
{
return
x
.
get
()
==
y
.
get
();
return
x
.
get
()
==
y
.
get
();
}
}
/// @relates intrusive_ptr
/// @relates intrusive_ptr
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
detail
::
enable_if_t
<
detail
::
is_comparable
<
T
*
,
U
*>::
value
,
bool
>
detail
::
enable_if_t
<
detail
::
is_comparable
_v
<
T
*
,
U
*>
,
bool
>
operator
!=
(
const
intrusive_ptr
<
T
>&
x
,
const
intrusive_ptr
<
U
>&
y
)
{
operator
!=
(
const
intrusive_ptr
<
T
>&
x
,
const
intrusive_ptr
<
U
>&
y
)
{
return
x
.
get
()
!=
y
.
get
();
return
x
.
get
()
!=
y
.
get
();
}
}
...
...
libcaf_core/caf/load_inspector.hpp
View file @
8f94dc06
...
@@ -343,7 +343,7 @@ public:
...
@@ -343,7 +343,7 @@ public:
template
<
class
T
>
template
<
class
T
>
static
auto
field
(
std
::
string_view
name
,
T
&
x
)
{
static
auto
field
(
std
::
string_view
name
,
T
&
x
)
{
static_assert
(
!
std
::
is_const
<
T
>::
value
);
static_assert
(
!
std
::
is_const
_v
<
T
>
);
return
field_t
<
T
>
{
name
,
&
x
};
return
field_t
<
T
>
{
name
,
&
x
};
}
}
...
...
libcaf_core/caf/load_inspector_base.hpp
View file @
8f94dc06
...
@@ -88,7 +88,7 @@ public:
...
@@ -88,7 +88,7 @@ public:
template
<
class
T
>
template
<
class
T
>
bool
tuple
(
T
&
xs
)
{
bool
tuple
(
T
&
xs
)
{
return
tuple
(
xs
,
std
::
make_index_sequence
<
std
::
tuple_size
<
T
>::
value
>
{});
return
tuple
(
xs
,
std
::
make_index_sequence
<
std
::
tuple_size
_v
<
T
>
>
{});
}
}
template
<
class
T
,
size_t
N
>
template
<
class
T
,
size_t
N
>
...
@@ -105,7 +105,7 @@ public:
...
@@ -105,7 +105,7 @@ public:
template
<
class
T
>
template
<
class
T
>
[[
nodiscard
]]
bool
apply
(
T
&
x
)
{
[[
nodiscard
]]
bool
apply
(
T
&
x
)
{
static_assert
(
!
std
::
is_const
<
T
>::
value
);
static_assert
(
!
std
::
is_const
_v
<
T
>
);
return
detail
::
load
(
dref
(),
x
);
return
detail
::
load
(
dref
(),
x
);
}
}
...
@@ -134,7 +134,7 @@ public:
...
@@ -134,7 +134,7 @@ public:
return
false
;
return
false
;
}
}
}
else
{
}
else
{
static_assert
(
std
::
is_convertible
<
setter_result
,
error
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
setter_result
,
error
>
,
"a setter must return caf::error, bool or void"
);
"a setter must return caf::error, bool or void"
);
if
(
dref
().
apply
(
tmp
))
{
if
(
dref
().
apply
(
tmp
))
{
if
(
auto
err
=
set
(
std
::
move
(
tmp
));
!
err
)
{
if
(
auto
err
=
set
(
std
::
move
(
tmp
));
!
err
)
{
...
...
libcaf_core/caf/logger.hpp
View file @
8f94dc06
...
@@ -165,7 +165,7 @@ public:
...
@@ -165,7 +165,7 @@ public:
line_builder
();
line_builder
();
template
<
class
T
>
template
<
class
T
>
detail
::
enable_if_t
<!
std
::
is_pointer
<
T
>::
value
,
line_builder
&>
detail
::
enable_if_t
<!
std
::
is_pointer
_v
<
T
>
,
line_builder
&>
operator
<<
(
const
T
&
x
)
{
operator
<<
(
const
T
&
x
)
{
if
(
!
str_
.
empty
())
if
(
!
str_
.
empty
())
str_
+=
" "
;
str_
+=
" "
;
...
...
libcaf_core/caf/mailbox_element.hpp
View file @
8f94dc06
...
@@ -109,7 +109,7 @@ make_mailbox_element(strong_actor_ptr sender, message_id id,
...
@@ -109,7 +109,7 @@ make_mailbox_element(strong_actor_ptr sender, message_id id,
/// @relates mailbox_element
/// @relates mailbox_element
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
std
::
enable_if_t
<!
std
::
is_same
<
typename
std
::
decay
<
T
>::
type
,
message
>::
value
std
::
enable_if_t
<!
std
::
is_same
_v
<
typename
std
::
decay
<
T
>::
type
,
message
>
||
(
sizeof
...(
Ts
)
>
0
),
||
(
sizeof
...(
Ts
)
>
0
),
mailbox_element_ptr
>
mailbox_element_ptr
>
make_mailbox_element
(
strong_actor_ptr
sender
,
message_id
id
,
make_mailbox_element
(
strong_actor_ptr
sender
,
message_id
id
,
...
...
libcaf_core/caf/message.hpp
View file @
8f94dc06
...
@@ -206,7 +206,7 @@ inline message make_message() {
...
@@ -206,7 +206,7 @@ inline message make_message() {
template
<
class
...
Ts
>
template
<
class
...
Ts
>
message
make_message
(
Ts
&&
...
xs
)
{
message
make_message
(
Ts
&&
...
xs
)
{
using
namespace
detail
;
using
namespace
detail
;
static_assert
((
!
std
::
is_pointer
<
strip_and_convert_t
<
Ts
>>::
value
&&
...));
static_assert
((
!
std
::
is_pointer
_v
<
strip_and_convert_t
<
Ts
>>
&&
...));
static_assert
((
is_complete
<
type_id
<
strip_and_convert_t
<
Ts
>>>
&&
...));
static_assert
((
is_complete
<
type_id
<
strip_and_convert_t
<
Ts
>>>
&&
...));
static
constexpr
size_t
data_size
static
constexpr
size_t
data_size
=
sizeof
(
message_data
)
+
(
padded_size_v
<
strip_and_convert_t
<
Ts
>>
+
...);
=
sizeof
(
message_data
)
+
(
padded_size_v
<
strip_and_convert_t
<
Ts
>>
+
...);
...
@@ -230,7 +230,7 @@ message make_message_from_tuple(Tuple&& xs, std::index_sequence<Is...>) {
...
@@ -230,7 +230,7 @@ message make_message_from_tuple(Tuple&& xs, std::index_sequence<Is...>) {
template
<
class
Tuple
>
template
<
class
Tuple
>
message
make_message_from_tuple
(
Tuple
&&
xs
)
{
message
make_message_from_tuple
(
Tuple
&&
xs
)
{
using
tuple_type
=
std
::
decay_t
<
Tuple
>
;
using
tuple_type
=
std
::
decay_t
<
Tuple
>
;
std
::
make_index_sequence
<
std
::
tuple_size
<
tuple_type
>::
value
>
seq
;
std
::
make_index_sequence
<
std
::
tuple_size
_v
<
tuple_type
>
>
seq
;
return
make_message_from_tuple
(
std
::
forward
<
Tuple
>
(
xs
),
seq
);
return
make_message_from_tuple
(
std
::
forward
<
Tuple
>
(
xs
),
seq
);
}
}
...
...
libcaf_core/caf/mixin/sender.hpp
View file @
8f94dc06
...
@@ -230,8 +230,7 @@ private:
...
@@ -230,8 +230,7 @@ private:
}
}
template
<
class
T
=
Base
>
template
<
class
T
=
Base
>
detail
::
enable_if_t
<
std
::
is_base_of
<
abstract_actor
,
T
>::
value
,
Subtype
*>
detail
::
enable_if_t
<
std
::
is_base_of_v
<
abstract_actor
,
T
>
,
Subtype
*>
dptr
()
{
dptr
()
{
return
static_cast
<
Subtype
*>
(
this
);
return
static_cast
<
Subtype
*>
(
this
);
}
}
...
...
libcaf_core/caf/mtl.hpp
View file @
8f94dc06
...
@@ -21,9 +21,9 @@ class event_based_mtl {
...
@@ -21,9 +21,9 @@ class event_based_mtl {
public:
public:
// -- sanity checks ----------------------------------------------------------
// -- sanity checks ----------------------------------------------------------
static_assert
(
std
::
is_nothrow_copy_assignable
<
Adapter
>::
value
);
static_assert
(
std
::
is_nothrow_copy_assignable
_v
<
Adapter
>
);
static_assert
(
std
::
is_nothrow_move_assignable
<
Adapter
>::
value
);
static_assert
(
std
::
is_nothrow_move_assignable
_v
<
Adapter
>
);
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
...
@@ -102,7 +102,7 @@ private:
...
@@ -102,7 +102,7 @@ private:
/// @ref deserializer directly or that provides a compatible API.
/// @ref deserializer directly or that provides a compatible API.
template
<
class
Self
,
class
Adapter
,
class
Reader
>
template
<
class
Self
,
class
Adapter
,
class
Reader
>
auto
make_mtl
(
Self
*
self
,
Adapter
adapter
,
Reader
*
reader
)
{
auto
make_mtl
(
Self
*
self
,
Adapter
adapter
,
Reader
*
reader
)
{
if
constexpr
(
std
::
is_base_of
<
non_blocking_actor_base
,
Self
>::
value
)
{
if
constexpr
(
std
::
is_base_of
_v
<
non_blocking_actor_base
,
Self
>
)
{
return
event_based_mtl
{
self
,
adapter
,
reader
};
return
event_based_mtl
{
self
,
adapter
,
reader
};
}
else
{
}
else
{
static_assert
(
detail
::
always_false_v
<
Self
>
,
static_assert
(
detail
::
always_false_v
<
Self
>
,
...
...
libcaf_core/caf/node_id.cpp
View file @
8f94dc06
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <random>
#include <random>
#include <sstream>
#include <sstream>
#include <string_view>
#include <string_view>
#include <tuple>
namespace
{
namespace
{
...
@@ -181,7 +182,7 @@ node_id make_node_id(uint32_t process_id,
...
@@ -181,7 +182,7 @@ node_id make_node_id(uint32_t process_id,
std
::
optional
<
node_id
>
make_node_id
(
uint32_t
process_id
,
std
::
optional
<
node_id
>
make_node_id
(
uint32_t
process_id
,
std
::
string_view
host_hash
)
{
std
::
string_view
host_hash
)
{
using
id_type
=
hashed_node_id
::
host_id_type
;
using
id_type
=
hashed_node_id
::
host_id_type
;
if
(
host_hash
.
size
()
!=
std
::
tuple_size
<
id_type
>::
value
*
2
)
if
(
host_hash
.
size
()
!=
std
::
tuple_size
_v
<
id_type
>
*
2
)
return
std
::
nullopt
;
return
std
::
nullopt
;
detail
::
parser
::
ascii_to_int
<
16
,
uint8_t
>
xvalue
;
detail
::
parser
::
ascii_to_int
<
16
,
uint8_t
>
xvalue
;
id_type
host_id
;
id_type
host_id
;
...
...
libcaf_core/caf/optional.hpp
View file @
8f94dc06
...
@@ -34,7 +34,7 @@ public:
...
@@ -34,7 +34,7 @@ public:
/// Creates an valid instance from `value`.
/// Creates an valid instance from `value`.
template
<
class
U
,
template
<
class
U
,
class
E
class
E
=
typename
std
::
enable_if
<
std
::
is_convertible
<
U
,
T
>
::
value
>::
type
>
=
typename
std
::
enable_if
<
std
::
is_convertible
_v
<
U
,
T
>
>::
type
>
optional
(
U
x
)
:
m_valid
(
false
)
{
optional
(
U
x
)
:
m_valid
(
false
)
{
cr
(
std
::
move
(
x
));
cr
(
std
::
move
(
x
));
}
}
...
@@ -45,8 +45,7 @@ public:
...
@@ -45,8 +45,7 @@ public:
}
}
}
}
optional
(
optional
&&
other
)
noexcept
(
optional
(
optional
&&
other
)
noexcept
(
std
::
is_nothrow_move_constructible_v
<
T
>
)
std
::
is_nothrow_move_constructible
<
T
>::
value
)
:
m_valid
(
false
)
{
:
m_valid
(
false
)
{
if
(
other
.
m_valid
)
{
if
(
other
.
m_valid
)
{
cr
(
std
::
move
(
other
.
m_value
));
cr
(
std
::
move
(
other
.
m_value
));
...
@@ -70,8 +69,7 @@ public:
...
@@ -70,8 +69,7 @@ public:
}
}
optional
&
operator
=
(
optional
&&
other
)
noexcept
(
optional
&
operator
=
(
optional
&&
other
)
noexcept
(
std
::
is_nothrow_destructible
<
T
>::
value
&&
std
::
is_nothrow_destructible_v
<
T
>&&
std
::
is_nothrow_move_assignable_v
<
T
>
)
{
std
::
is_nothrow_move_assignable
<
T
>::
value
)
{
if
(
m_valid
)
{
if
(
m_valid
)
{
if
(
other
.
m_valid
)
if
(
other
.
m_valid
)
m_value
=
std
::
move
(
other
.
m_value
);
m_value
=
std
::
move
(
other
.
m_value
);
...
...
libcaf_core/caf/save_inspector.hpp
View file @
8f94dc06
...
@@ -239,7 +239,7 @@ public:
...
@@ -239,7 +239,7 @@ public:
template
<
class
T
>
template
<
class
T
>
static
auto
field
(
std
::
string_view
name
,
T
&
x
)
{
static
auto
field
(
std
::
string_view
name
,
T
&
x
)
{
static_assert
(
!
std
::
is_const
<
T
>::
value
);
static_assert
(
!
std
::
is_const
_v
<
T
>
);
return
field_t
<
T
>
{
name
,
std
::
addressof
(
x
)};
return
field_t
<
T
>
{
name
,
std
::
addressof
(
x
)};
}
}
...
...
libcaf_core/caf/save_inspector_base.hpp
View file @
8f94dc06
...
@@ -81,7 +81,7 @@ public:
...
@@ -81,7 +81,7 @@ public:
template
<
class
T
>
template
<
class
T
>
bool
tuple
(
const
T
&
xs
)
{
bool
tuple
(
const
T
&
xs
)
{
return
tuple
(
xs
,
std
::
make_index_sequence
<
std
::
tuple_size
<
T
>::
value
>
{});
return
tuple
(
xs
,
std
::
make_index_sequence
<
std
::
tuple_size
_v
<
T
>
>
{});
}
}
template
<
class
T
,
size_t
N
>
template
<
class
T
,
size_t
N
>
...
...
libcaf_core/caf/serializer.hpp
View file @
8f94dc06
...
@@ -134,7 +134,7 @@ public:
...
@@ -134,7 +134,7 @@ public:
/// @copydoc value
/// @copydoc value
template
<
class
T
>
template
<
class
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
bool
>
value
(
T
x
)
{
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
,
bool
>
value
(
T
x
)
{
return
value
(
static_cast
<
detail
::
squashed_int_t
<
T
>>
(
x
));
return
value
(
static_cast
<
detail
::
squashed_int_t
<
T
>>
(
x
));
}
}
...
...
libcaf_core/caf/stateful_actor.hpp
View file @
8f94dc06
...
@@ -28,7 +28,7 @@ public:
...
@@ -28,7 +28,7 @@ public:
/// on whether `State::make_behavior()` exists.
/// on whether `State::make_behavior()` exists.
template
<
class
State
,
class
Base
>
template
<
class
State
,
class
Base
>
using
stateful_actor_base_t
using
stateful_actor_base_t
=
std
::
conditional_t
<
has_make_behavior_member
<
State
>::
value
,
=
std
::
conditional_t
<
has_make_behavior_member
_v
<
State
>
,
stateful_actor_base
<
State
,
Base
>
,
Base
>
;
stateful_actor_base
<
State
,
Base
>
,
Base
>
;
}
// namespace caf::detail
}
// namespace caf::detail
...
@@ -46,7 +46,7 @@ public:
...
@@ -46,7 +46,7 @@ public:
template
<
class
...
Ts
>
template
<
class
...
Ts
>
explicit
stateful_actor
(
actor_config
&
cfg
,
Ts
&&
...
xs
)
:
super
(
cfg
)
{
explicit
stateful_actor
(
actor_config
&
cfg
,
Ts
&&
...
xs
)
:
super
(
cfg
)
{
if
constexpr
(
std
::
is_constructible
<
State
,
Ts
&&
...
>::
value
)
if
constexpr
(
std
::
is_constructible
_v
<
State
,
Ts
&&
...
>
)
new
(
&
state
)
State
(
std
::
forward
<
Ts
>
(
xs
)...);
new
(
&
state
)
State
(
std
::
forward
<
Ts
>
(
xs
)...);
else
else
new
(
&
state
)
State
(
this
,
std
::
forward
<
Ts
>
(
xs
)...);
new
(
&
state
)
State
(
this
,
std
::
forward
<
Ts
>
(
xs
)...);
...
...
libcaf_core/caf/string_view.hpp
View file @
8f94dc06
...
@@ -31,13 +31,12 @@ struct is_string_like {
...
@@ -31,13 +31,12 @@ struct is_string_like {
const
U
*
x
,
const
U
*
x
,
// check if `x->data()` returns const char*
// check if `x->data()` returns const char*
std
::
enable_if_t
<
std
::
enable_if_t
<
std
::
is_same
<
const
char
*
,
decltype
(
x
->
data
())
>::
value
>*
=
nullptr
,
std
::
is_same
_v
<
const
char
*
,
decltype
(
x
->
data
())
>
>*
=
nullptr
,
// check if `x->size()` returns an integer
// check if `x->size()` returns an integer
std
::
enable_if_t
<
std
::
is_integral
<
decltype
(
x
->
size
())
>::
value
>*
=
nullptr
,
std
::
enable_if_t
<
std
::
is_integral
_v
<
decltype
(
x
->
size
())
>
>*
=
nullptr
,
// check if `x->find('?', 0)` is well-formed and returns an integer
// check if `x->find('?', 0)` is well-formed and returns an integer
// (distinguishes vectors from strings)
// (distinguishes vectors from strings)
std
::
enable_if_t
<
std
::
enable_if_t
<
std
::
is_integral_v
<
decltype
(
x
->
find
(
'?'
,
0
))
>>*
=
nullptr
);
std
::
is_integral
<
decltype
(
x
->
find
(
'?'
,
0
))
>::
value
>*
=
nullptr
);
// SFINAE fallback.
// SFINAE fallback.
static
void
sfinae
(
void
*
);
static
void
sfinae
(
void
*
);
...
...
libcaf_core/caf/telemetry/collector/prometheus.cpp
View file @
8f94dc06
...
@@ -58,7 +58,7 @@ template <class... Ts>
...
@@ -58,7 +58,7 @@ template <class... Ts>
void
append
(
prometheus
::
char_buffer
&
,
double
,
Ts
&&
...);
void
append
(
prometheus
::
char_buffer
&
,
double
,
Ts
&&
...);
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
>
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
>
append
(
prometheus
::
char_buffer
&
buf
,
T
val
,
Ts
&&
...
xs
);
append
(
prometheus
::
char_buffer
&
buf
,
T
val
,
Ts
&&
...
xs
);
template
<
class
...
Ts
>
template
<
class
...
Ts
>
...
@@ -120,7 +120,7 @@ void append(prometheus::char_buffer& buf, double val, Ts&&... xs) {
...
@@ -120,7 +120,7 @@ void append(prometheus::char_buffer& buf, double val, Ts&&... xs) {
}
}
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
>
std
::
enable_if_t
<
std
::
is_integral
_v
<
T
>
>
append
(
prometheus
::
char_buffer
&
buf
,
T
val
,
Ts
&&
...
xs
)
{
append
(
prometheus
::
char_buffer
&
buf
,
T
val
,
Ts
&&
...
xs
)
{
append
(
buf
,
std
::
to_string
(
val
));
append
(
buf
,
std
::
to_string
(
val
));
append
(
buf
,
std
::
forward
<
Ts
>
(
xs
)...);
append
(
buf
,
std
::
forward
<
Ts
>
(
xs
)...);
...
...
libcaf_core/caf/typed_actor.hpp
View file @
8f94dc06
...
@@ -131,7 +131,7 @@ public:
...
@@ -131,7 +131,7 @@ public:
// Enable `handle_type{self}` for typed actor views.
// Enable `handle_type{self}` for typed actor views.
template
<
class
T
,
class
=
std
::
enable_if_t
<
template
<
class
T
,
class
=
std
::
enable_if_t
<
std
::
is_base_of
<
typed_actor_view_base
,
T
>
::
value
>>
std
::
is_base_of
_v
<
typed_actor_view_base
,
T
>
>>
explicit
typed_actor
(
T
ptr
)
:
ptr_
(
ptr
.
ctrl
())
{
explicit
typed_actor
(
T
ptr
)
:
ptr_
(
ptr
.
ctrl
())
{
static_assert
(
static_assert
(
detail
::
tl_subset_of
<
signatures
,
typename
T
::
signatures
>::
value
,
detail
::
tl_subset_of
<
signatures
,
typename
T
::
signatures
>::
value
,
...
...
libcaf_core/caf/typed_response_promise.hpp
View file @
8f94dc06
...
@@ -75,8 +75,7 @@ public:
...
@@ -75,8 +75,7 @@ public:
/// Satisfies the promise by sending a non-error response message.
/// Satisfies the promise by sending a non-error response message.
template
<
class
...
Us
>
template
<
class
...
Us
>
std
::
enable_if_t
<
(
std
::
is_constructible
<
Ts
,
Us
>::
value
&&
...)
>
std
::
enable_if_t
<
(
std
::
is_constructible_v
<
Ts
,
Us
>
&&
...)
>
deliver
(
Us
...
xs
)
{
deliver
(
Us
...
xs
)
{
promise_
.
deliver
(
Ts
{
std
::
forward
<
Us
>
(
xs
)}...);
promise_
.
deliver
(
Ts
{
std
::
forward
<
Us
>
(
xs
)}...);
}
}
...
...
libcaf_core/caf/weak_intrusive_ptr.hpp
View file @
8f94dc06
...
@@ -51,8 +51,7 @@ public:
...
@@ -51,8 +51,7 @@ public:
template
<
class
Y
>
template
<
class
Y
>
weak_intrusive_ptr
(
weak_intrusive_ptr
<
Y
>
other
)
noexcept
weak_intrusive_ptr
(
weak_intrusive_ptr
<
Y
>
other
)
noexcept
:
ptr_
(
other
.
detach
())
{
:
ptr_
(
other
.
detach
())
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
static_assert
(
std
::
is_convertible_v
<
Y
*
,
T
*>
,
"Y* is not assignable to T*"
);
"Y* is not assignable to T*"
);
}
}
~
weak_intrusive_ptr
()
{
~
weak_intrusive_ptr
()
{
...
...
libcaf_core/tests/legacy/config_option.cpp
View file @
8f94dc06
...
@@ -223,7 +223,7 @@ void check_integer_options(std::false_type) {
...
@@ -223,7 +223,7 @@ void check_integer_options(std::false_type) {
// only works with an integral types and double
// only works with an integral types and double
template
<
class
T
>
template
<
class
T
>
void
check_integer_options
()
{
void
check_integer_options
()
{
std
::
integral_constant
<
bool
,
std
::
is_unsigned
<
T
>::
value
>
tk
;
std
::
integral_constant
<
bool
,
std
::
is_unsigned
_v
<
T
>
>
tk
;
check_integer_options
<
T
>
(
tk
);
check_integer_options
<
T
>
(
tk
);
}
}
...
...
libcaf_core/tests/legacy/detail/parser/read_number.cpp
View file @
8f94dc06
...
@@ -105,13 +105,12 @@ struct range_parser {
...
@@ -105,13 +105,12 @@ struct range_parser {
};
};
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
,
res_t
>::
type
res
(
T
x
)
{
typename
std
::
enable_if
<
std
::
is_integral
_v
<
T
>
,
res_t
>::
type
res
(
T
x
)
{
return
{
static_cast
<
int64_t
>
(
x
)};
return
{
static_cast
<
int64_t
>
(
x
)};
}
}
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>::
value
,
res_t
>::
type
typename
std
::
enable_if
<
std
::
is_floating_point_v
<
T
>
,
res_t
>::
type
res
(
T
x
)
{
res
(
T
x
)
{
return
{
static_cast
<
double
>
(
x
)};
return
{
static_cast
<
double
>
(
x
)};
}
}
...
...
libcaf_core/tests/legacy/detail/parser/read_number_or_timespan.cpp
View file @
8f94dc06
...
@@ -72,13 +72,12 @@ struct fixture {
...
@@ -72,13 +72,12 @@ struct fixture {
};
};
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
,
res_t
>::
type
res
(
T
x
)
{
typename
std
::
enable_if
<
std
::
is_integral
_v
<
T
>
,
res_t
>::
type
res
(
T
x
)
{
return
res_t
{
static_cast
<
int64_t
>
(
x
)};
return
res_t
{
static_cast
<
int64_t
>
(
x
)};
}
}
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>::
value
,
res_t
>::
type
typename
std
::
enable_if
<
std
::
is_floating_point_v
<
T
>
,
res_t
>::
type
res
(
T
x
)
{
res
(
T
x
)
{
return
res_t
{
static_cast
<
double
>
(
x
)};
return
res_t
{
static_cast
<
double
>
(
x
)};
}
}
...
...
libcaf_core/tests/legacy/metaprogramming.cpp
View file @
8f94dc06
...
@@ -231,14 +231,14 @@ private:
...
@@ -231,14 +231,14 @@ private:
};
};
CAF_TEST
(
is_comparable
)
{
CAF_TEST
(
is_comparable
)
{
CHECK
((
is_comparable
<
double
,
std
::
string
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
double
,
std
::
string
>
)
==
false
);
CHECK
((
is_comparable
<
foo
,
foo
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
foo
,
foo
>
)
==
false
);
CHECK
((
is_comparable
<
bar
,
bar
>::
value
)
==
true
);
CHECK
((
is_comparable
_v
<
bar
,
bar
>
)
==
true
);
CHECK
((
is_comparable
<
double
,
bar
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
double
,
bar
>
)
==
false
);
CHECK
((
is_comparable
<
bar
,
double
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
bar
,
double
>
)
==
false
);
CHECK
((
is_comparable
<
baz
,
baz
>::
value
)
==
true
);
CHECK
((
is_comparable
_v
<
baz
,
baz
>
)
==
true
);
CHECK
((
is_comparable
<
double
,
baz
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
double
,
baz
>
)
==
false
);
CHECK
((
is_comparable
<
baz
,
double
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
baz
,
double
>
)
==
false
);
CHECK
((
is_comparable
<
std
::
string
,
baz
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
std
::
string
,
baz
>
)
==
false
);
CHECK
((
is_comparable
<
baz
,
std
::
string
>::
value
)
==
false
);
CHECK
((
is_comparable
_v
<
baz
,
std
::
string
>
)
==
false
);
}
}
libcaf_core/tests/legacy/typed_spawn.cpp
View file @
8f94dc06
...
@@ -28,17 +28,17 @@ using dummy1 = typed_actor<result<void>(int, int), result<double>(double)>;
...
@@ -28,17 +28,17 @@ using dummy1 = typed_actor<result<void>(int, int), result<double>(double)>;
using
dummy2
=
dummy1
::
extend
<
result
<
void
>
(
ok_atom
)
>
;
using
dummy2
=
dummy1
::
extend
<
result
<
void
>
(
ok_atom
)
>
;
static_assert
(
std
::
is_convertible
<
dummy2
,
dummy1
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
dummy2
,
dummy1
>
,
"handle not assignable to narrower definition"
);
"handle not assignable to narrower definition"
);
using
dummy3
=
typed_actor
<
result
<
void
>
(
float
,
int
)
>
;
using
dummy3
=
typed_actor
<
result
<
void
>
(
float
,
int
)
>
;
using
dummy4
=
typed_actor
<
result
<
double
>
(
int
)
>
;
using
dummy4
=
typed_actor
<
result
<
double
>
(
int
)
>
;
using
dummy5
=
dummy4
::
extend_with
<
dummy3
>
;
using
dummy5
=
dummy4
::
extend_with
<
dummy3
>
;
static_assert
(
std
::
is_convertible
<
dummy5
,
dummy3
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
dummy5
,
dummy3
>
,
"handle not assignable to narrower definition"
);
"handle not assignable to narrower definition"
);
static_assert
(
std
::
is_convertible
<
dummy5
,
dummy4
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
dummy5
,
dummy4
>
,
"handle not assignable to narrower definition"
);
"handle not assignable to narrower definition"
);
// -- simple request/response test ---------------------------------------------
// -- simple request/response test ---------------------------------------------
...
...
libcaf_io/caf/io/typed_broker.hpp
View file @
8f94dc06
...
@@ -123,13 +123,13 @@ public:
...
@@ -123,13 +123,13 @@ public:
expected
<
connection_handle
>
add_tcp_scribe
(
const
std
::
string
&
host
,
expected
<
connection_handle
>
add_tcp_scribe
(
const
std
::
string
&
host
,
uint16_t
port
)
{
uint16_t
port
)
{
static_assert
(
std
::
is_convertible
<
actor_hdl
,
connection_handler
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
actor_hdl
,
connection_handler
>
,
"Cannot add scribe: broker misses required handlers"
);
"Cannot add scribe: broker misses required handlers"
);
return
super
::
add_tcp_scribe
(
host
,
port
);
return
super
::
add_tcp_scribe
(
host
,
port
);
}
}
connection_handle
add_tcp_scribe
(
network
::
native_socket
fd
)
{
connection_handle
add_tcp_scribe
(
network
::
native_socket
fd
)
{
static_assert
(
std
::
is_convertible
<
actor_hdl
,
connection_handler
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
actor_hdl
,
connection_handler
>
,
"Cannot add scribe: broker misses required handlers"
);
"Cannot add scribe: broker misses required handlers"
);
return
super
::
add_tcp_scribe
(
fd
);
return
super
::
add_tcp_scribe
(
fd
);
}
}
...
@@ -137,13 +137,13 @@ public:
...
@@ -137,13 +137,13 @@ public:
expected
<
std
::
pair
<
accept_handle
,
uint16_t
>>
expected
<
std
::
pair
<
accept_handle
,
uint16_t
>>
add_tcp_doorman
(
uint16_t
port
=
0
,
const
char
*
in
=
nullptr
,
add_tcp_doorman
(
uint16_t
port
=
0
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
{
bool
reuse_addr
=
false
)
{
static_assert
(
std
::
is_convertible
<
actor_hdl
,
accept_handler
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
actor_hdl
,
accept_handler
>
,
"Cannot add doorman: broker misses required handlers"
);
"Cannot add doorman: broker misses required handlers"
);
return
super
::
add_tcp_doorman
(
port
,
in
,
reuse_addr
);
return
super
::
add_tcp_doorman
(
port
,
in
,
reuse_addr
);
}
}
expected
<
accept_handle
>
add_tcp_doorman
(
network
::
native_socket
fd
)
{
expected
<
accept_handle
>
add_tcp_doorman
(
network
::
native_socket
fd
)
{
static_assert
(
std
::
is_convertible
<
actor_hdl
,
accept_handler
>::
value
,
static_assert
(
std
::
is_convertible
_v
<
actor_hdl
,
accept_handler
>
,
"Cannot add doorman: broker misses required handlers"
);
"Cannot add doorman: broker misses required handlers"
);
return
super
::
add_tcp_doorman
(
fd
);
return
super
::
add_tcp_doorman
(
fd
);
}
}
...
...
libcaf_test/caf/test/dsl.hpp
View file @
8f94dc06
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "caf/config.hpp"
#include "caf/config.hpp"
#include "caf/init_global_meta_objects.hpp"
#include "caf/init_global_meta_objects.hpp"
#include <tuple>
#include <type_traits>
#include <type_traits>
CAF_PUSH_WARNINGS
CAF_PUSH_WARNINGS
...
@@ -164,8 +165,7 @@ public:
...
@@ -164,8 +165,7 @@ public:
return
*
this
;
return
*
this
;
}
}
template
<
class
T
,
template
<
class
T
,
class
E
=
caf
::
detail
::
enable_if_t
<!
std
::
is_pointer_v
<
T
>
>>
class
E
=
caf
::
detail
::
enable_if_t
<!
std
::
is_pointer
<
T
>
::
value
>>
caf_handle
&
operator
=
(
const
T
&
x
)
{
caf_handle
&
operator
=
(
const
T
&
x
)
{
set
(
x
);
set
(
x
);
return
*
this
;
return
*
this
;
...
...
libcaf_test/caf/test/unit_test.hpp
View file @
8f94dc06
...
@@ -66,14 +66,14 @@ struct compare_visitor {
...
@@ -66,14 +66,14 @@ struct compare_visitor {
struct
equality_operator
{
struct
equality_operator
{
static
constexpr
bool
default_value
=
false
;
static
constexpr
bool
default_value
=
false
;
template
<
class
T
,
class
U
,
template
<
detail
::
enable_if_t
<
((
std
::
is_floating_point
<
T
>
::
value
class
T
,
class
U
,
&&
std
::
is_convertible
<
U
,
double
>::
value
)
detail
::
enable_if_t
<
||
(
std
::
is_floating_point
<
U
>::
value
((
std
::
is_floating_point_v
<
T
>
&&
std
::
is_convertible_v
<
U
,
double
>
)
&&
std
::
is_convertible
<
T
,
double
>::
value
)
)
||
(
std
::
is_floating_point_v
<
U
>
&&
std
::
is_convertible_v
<
T
,
double
>
)
)
&&
detail
::
is_comparable
<
T
,
U
>::
value
,
&&
detail
::
is_comparable_v
<
T
,
U
>
,
int
>
int
>
=
0
>
=
0
>
bool
operator
()(
const
T
&
t
,
const
U
&
u
)
const
{
bool
operator
()(
const
T
&
t
,
const
U
&
u
)
const
{
auto
x
=
static_cast
<
long
double
>
(
t
);
auto
x
=
static_cast
<
long
double
>
(
t
);
auto
y
=
static_cast
<
long
double
>
(
u
);
auto
y
=
static_cast
<
long
double
>
(
u
);
...
@@ -82,21 +82,20 @@ struct equality_operator {
...
@@ -82,21 +82,20 @@ struct equality_operator {
return
dif
<=
max
*
1e-5l
;
return
dif
<=
max
*
1e-5l
;
}
}
template
<
class
T
,
class
U
,
template
<
detail
::
enable_if_t
<!
((
std
::
is_floating_point
<
T
>
::
value
class
T
,
class
U
,
&&
std
::
is_convertible
<
U
,
double
>::
value
)
detail
::
enable_if_t
<
||
(
std
::
is_floating_point
<
U
>::
value
!
((
std
::
is_floating_point_v
<
T
>
&&
std
::
is_convertible_v
<
U
,
double
>
)
&&
std
::
is_convertible
<
T
,
double
>::
value
)
)
||
(
std
::
is_floating_point_v
<
U
>
&&
std
::
is_convertible_v
<
T
,
double
>
)
)
&&
detail
::
is_comparable
<
T
,
U
>::
value
,
&&
detail
::
is_comparable_v
<
T
,
U
>
,
int
>
int
>
=
0
>
=
0
>
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
return
x
==
y
;
return
x
==
y
;
}
}
template
<
template
<
class
T
,
class
U
,
class
T
,
class
U
,
typename
std
::
enable_if
<!
detail
::
is_comparable_v
<
T
,
U
>
>::
type
=
0
>
typename
std
::
enable_if
<!
detail
::
is_comparable
<
T
,
U
>
::
value
,
int
>::
type
=
0
>
bool
operator
()(
const
T
&
,
const
U
&
)
const
{
bool
operator
()(
const
T
&
,
const
U
&
)
const
{
return
default_value
;
return
default_value
;
}
}
...
@@ -106,10 +105,10 @@ struct inequality_operator {
...
@@ -106,10 +105,10 @@ struct inequality_operator {
static
constexpr
bool
default_value
=
true
;
static
constexpr
bool
default_value
=
true
;
template
<
class
T
,
class
U
,
template
<
class
T
,
class
U
,
typename
std
::
enable_if
<
(
std
::
is_floating_point
<
T
>
::
value
typename
std
::
enable_if
<
||
std
::
is_floating_point
<
U
>::
value
)
(
std
::
is_floating_point_v
<
T
>
&&
detail
::
is_comparable
<
T
,
U
>::
value
,
||
std
::
is_floating_point_v
<
U
>
)
&&
detail
::
is_comparable_v
<
T
,
U
>
,
int
>::
type
int
>::
type
=
0
>
=
0
>
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
equality_operator
f
;
equality_operator
f
;
...
@@ -117,18 +116,17 @@ struct inequality_operator {
...
@@ -117,18 +116,17 @@ struct inequality_operator {
}
}
template
<
class
T
,
class
U
,
template
<
class
T
,
class
U
,
typename
std
::
enable_if
<!
std
::
is_floating_point
<
T
>
::
value
typename
std
::
enable_if
<!
std
::
is_floating_point
_v
<
T
>
&&
!
std
::
is_floating_point
<
U
>::
value
&&
!
std
::
is_floating_point
_v
<
U
>
&&
detail
::
is_comparable
<
T
,
U
>::
value
,
&&
detail
::
is_comparable
_v
<
T
,
U
>
,
int
>::
type
int
>::
type
=
0
>
=
0
>
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
return
x
!=
y
;
return
x
!=
y
;
}
}
template
<
template
<
class
T
,
class
U
,
class
T
,
class
U
,
typename
std
::
enable_if
<!
detail
::
is_comparable_v
<
T
,
U
>
>::
type
=
0
>
typename
std
::
enable_if
<!
detail
::
is_comparable
<
T
,
U
>
::
value
,
int
>::
type
=
0
>
bool
operator
()(
const
T
&
,
const
U
&
)
const
{
bool
operator
()(
const
T
&
,
const
U
&
)
const
{
return
default_value
;
return
default_value
;
}
}
...
@@ -294,7 +292,7 @@ public:
...
@@ -294,7 +292,7 @@ public:
};
};
using
fwd
=
using
fwd
=
typename
std
::
conditional
<
std
::
is_same_v
<
char
,
T
>
typename
std
::
conditional
<
std
::
is_same_v
<
char
,
T
>
||
std
::
is_convertible
<
T
,
std
::
string
>::
value
||
std
::
is_convertible
_v
<
T
,
std
::
string
>
||
std
::
is_same_v
<
caf
::
term
,
T
>
,
||
std
::
is_same_v
<
caf
::
term
,
T
>
,
simple_fwd_t
,
deep_to_string_t
>::
type
;
simple_fwd_t
,
deep_to_string_t
>::
type
;
fwd
f
;
fwd
f
;
...
...
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