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
59a85143
Unverified
Commit
59a85143
authored
Jul 17, 2023
by
Dominik Charousset
Committed by
GitHub
Jul 17, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1495
Refactor all calls to is_same::value to is_same_v
parents
61f3fc1c
2994355f
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
101 additions
and
107 deletions
+101
-107
examples/custom_type/custom_types_4.cpp
examples/custom_type/custom_types_4.cpp
+1
-1
examples/remoting/distributed_calculator.cpp
examples/remoting/distributed_calculator.cpp
+1
-1
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+1
-1
libcaf_core/caf/config_value.hpp
libcaf_core/caf/config_value.hpp
+9
-9
libcaf_core/caf/config_value_reader.cpp
libcaf_core/caf/config_value_reader.cpp
+1
-1
libcaf_core/caf/config_value_writer.cpp
libcaf_core/caf/config_value_writer.cpp
+1
-1
libcaf_core/caf/detail/behavior_impl.hpp
libcaf_core/caf/detail/behavior_impl.hpp
+1
-1
libcaf_core/caf/detail/config_consumer.cpp
libcaf_core/caf/detail/config_consumer.cpp
+1
-1
libcaf_core/caf/detail/mtl_util.hpp
libcaf_core/caf/detail/mtl_util.hpp
+1
-1
libcaf_core/caf/detail/parser/fsm.hpp
libcaf_core/caf/detail/parser/fsm.hpp
+1
-1
libcaf_core/caf/detail/parser/read_string.hpp
libcaf_core/caf/detail/parser/read_string.hpp
+4
-5
libcaf_core/caf/detail/profiled_send.hpp
libcaf_core/caf/detail/profiled_send.hpp
+1
-1
libcaf_core/caf/detail/set_thread_name.cpp
libcaf_core/caf/detail/set_thread_name.cpp
+1
-1
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+3
-3
libcaf_core/caf/detail/type_list.hpp
libcaf_core/caf/detail/type_list.hpp
+5
-7
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+8
-9
libcaf_core/caf/detail/typed_actor_util.hpp
libcaf_core/caf/detail/typed_actor_util.hpp
+3
-3
libcaf_core/caf/error_code.hpp
libcaf_core/caf/error_code.hpp
+1
-1
libcaf_core/caf/exec_main.hpp
libcaf_core/caf/exec_main.hpp
+1
-1
libcaf_core/caf/inspector_access.hpp
libcaf_core/caf/inspector_access.hpp
+3
-3
libcaf_core/caf/load_inspector.hpp
libcaf_core/caf/load_inspector.hpp
+7
-7
libcaf_core/caf/load_inspector_base.hpp
libcaf_core/caf/load_inspector_base.hpp
+2
-2
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+1
-1
libcaf_core/caf/mixin/sender.hpp
libcaf_core/caf/mixin/sender.hpp
+3
-3
libcaf_core/caf/mtl.hpp
libcaf_core/caf/mtl.hpp
+1
-1
libcaf_core/caf/node_id.cpp
libcaf_core/caf/node_id.cpp
+1
-1
libcaf_core/caf/response_handle.hpp
libcaf_core/caf/response_handle.hpp
+3
-3
libcaf_core/caf/response_promise.hpp
libcaf_core/caf/response_promise.hpp
+1
-2
libcaf_core/caf/resumable.hpp
libcaf_core/caf/resumable.hpp
+2
-2
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/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+2
-2
libcaf_core/caf/send.hpp
libcaf_core/caf/send.hpp
+1
-1
libcaf_core/caf/settings.hpp
libcaf_core/caf/settings.hpp
+1
-1
libcaf_core/caf/string_view.hpp
libcaf_core/caf/string_view.hpp
+1
-1
libcaf_core/caf/telemetry/counter.hpp
libcaf_core/caf/telemetry/counter.hpp
+4
-4
libcaf_core/caf/telemetry/histogram.hpp
libcaf_core/caf/telemetry/histogram.hpp
+3
-3
libcaf_core/caf/telemetry/metric_family_impl.hpp
libcaf_core/caf/telemetry/metric_family_impl.hpp
+1
-1
libcaf_core/caf/typed_behavior.hpp
libcaf_core/caf/typed_behavior.hpp
+1
-1
libcaf_core/caf/typed_response_promise.hpp
libcaf_core/caf/typed_response_promise.hpp
+2
-2
libcaf_core/test/actor_lifetime.cpp
libcaf_core/test/actor_lifetime.cpp
+1
-1
libcaf_core/test/config_value.cpp
libcaf_core/test/config_value.cpp
+2
-2
libcaf_core/test/json_reader.cpp
libcaf_core/test/json_reader.cpp
+1
-1
libcaf_core/test/metaprogramming.cpp
libcaf_core/test/metaprogramming.cpp
+1
-1
libcaf_core/test/typed_behavior.cpp
libcaf_core/test/typed_behavior.cpp
+1
-1
libcaf_io/caf/io/broker_servant.hpp
libcaf_io/caf/io/broker_servant.hpp
+4
-5
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
+2
-2
No files found.
examples/custom_type/custom_types_4.cpp
View file @
59a85143
...
@@ -173,7 +173,7 @@ struct variant_inspector_traits<shape_ptr> {
...
@@ -173,7 +173,7 @@ struct variant_inspector_traits<shape_ptr> {
// Assigns a value to x.
// Assigns a value to x.
template
<
class
U
>
template
<
class
U
>
static
void
assign
(
value_type
&
x
,
U
value
)
{
static
void
assign
(
value_type
&
x
,
U
value
)
{
if
constexpr
(
std
::
is_same
<
U
,
none_t
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
U
,
none_t
>
)
x
.
reset
();
x
.
reset
();
else
else
x
=
std
::
make_shared
<
U
>
(
std
::
move
(
value
));
x
=
std
::
make_shared
<
U
>
(
std
::
move
(
value
));
...
...
examples/remoting/distributed_calculator.cpp
View file @
59a85143
...
@@ -155,7 +155,7 @@ behavior running(stateful_actor<state>* self, const actor& calculator) {
...
@@ -155,7 +155,7 @@ behavior running(stateful_actor<state>* self, const actor& calculator) {
.
then
(
.
then
(
[
=
](
int
result
)
{
[
=
](
int
result
)
{
const
char
*
op_str
;
const
char
*
op_str
;
if
constexpr
(
std
::
is_same
<
add_atom
,
decltype
(
op
)
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
add_atom
,
decltype
(
op
)
>
)
op_str
=
" + "
;
op_str
=
" + "
;
else
else
op_str
=
" - "
;
op_str
=
" - "
;
...
...
libcaf_core/caf/actor_system.hpp
View file @
59a85143
...
@@ -465,7 +465,7 @@ public:
...
@@ -465,7 +465,7 @@ public:
template
<
class
T
,
spawn_options
Os
,
class
Iter
,
class
...
Ts
>
template
<
class
T
,
spawn_options
Os
,
class
Iter
,
class
...
Ts
>
infer_handle_from_class_t
<
T
>
infer_handle_from_class_t
<
T
>
spawn_class_in_groups
(
actor_config
&
cfg
,
Iter
first
,
Iter
last
,
Ts
&&
...
xs
)
{
spawn_class_in_groups
(
actor_config
&
cfg
,
Iter
first
,
Iter
last
,
Ts
&&
...
xs
)
{
static_assert
(
std
::
is_same
<
infer_handle_from_class_t
<
T
>
,
actor
>::
value
,
static_assert
(
std
::
is_same
_v
<
infer_handle_from_class_t
<
T
>
,
actor
>
,
"only dynamically-typed actors can be spawned in a group"
);
"only dynamically-typed actors can be spawned in a group"
);
check_invariants
<
T
>
();
check_invariants
<
T
>
();
auto
irange
=
make_input_range
(
first
,
last
);
auto
irange
=
make_input_range
(
first
,
last
);
...
...
libcaf_core/caf/config_value.hpp
View file @
59a85143
...
@@ -98,7 +98,7 @@ public:
...
@@ -98,7 +98,7 @@ public:
config_value
(
const
config_value
&
other
)
=
default
;
config_value
(
const
config_value
&
other
)
=
default
;
template
<
class
T
,
class
E
=
detail
::
enable_if_t
<
template
<
class
T
,
class
E
=
detail
::
enable_if_t
<
!
std
::
is_same
<
detail
::
decay_t
<
T
>,
config_value
>::
value
>>
!
std
::
is_same
_v
<
detail
::
decay_t
<
T
>,
config_value
>
>>
explicit
config_value
(
T
&&
x
)
{
explicit
config_value
(
T
&&
x
)
{
set
(
std
::
forward
<
T
>
(
x
));
set
(
std
::
forward
<
T
>
(
x
));
}
}
...
@@ -108,7 +108,7 @@ public:
...
@@ -108,7 +108,7 @@ public:
config_value
&
operator
=
(
const
config_value
&
other
)
=
default
;
config_value
&
operator
=
(
const
config_value
&
other
)
=
default
;
template
<
class
T
,
class
E
=
detail
::
enable_if_t
<
template
<
class
T
,
class
E
=
detail
::
enable_if_t
<
!
std
::
is_same
<
detail
::
decay_t
<
T
>,
config_value
>::
value
>>
!
std
::
is_same
_v
<
detail
::
decay_t
<
T
>,
config_value
>
>>
config_value
&
operator
=
(
T
&&
x
)
{
config_value
&
operator
=
(
T
&&
x
)
{
set
(
std
::
forward
<
T
>
(
x
));
set
(
std
::
forward
<
T
>
(
x
));
return
*
this
;
return
*
this
;
...
@@ -361,9 +361,9 @@ get_as(const config_value& x, inspector_access_type::builtin_inspect token) {
...
@@ -361,9 +361,9 @@ get_as(const config_value& x, inspector_access_type::builtin_inspect token) {
template
<
class
T
>
template
<
class
T
>
expected
<
T
>
get_as
(
const
config_value
&
x
,
inspector_access_type
::
builtin
)
{
expected
<
T
>
get_as
(
const
config_value
&
x
,
inspector_access_type
::
builtin
)
{
if
constexpr
(
std
::
is_same
<
T
,
std
::
string
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
T
,
std
::
string
>
)
{
return
to_string
(
x
);
return
to_string
(
x
);
}
else
if
constexpr
(
std
::
is_same
<
T
,
bool
>::
value
)
{
}
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
<
T
>::
value
)
{
if
(
auto
result
=
x
.
to_integer
())
{
if
(
auto
result
=
x
.
to_integer
())
{
...
@@ -488,13 +488,13 @@ expected<T> get_as(const config_value& x, inspector_access_type::list) {
...
@@ -488,13 +488,13 @@ expected<T> get_as(const config_value& x, inspector_access_type::list) {
/// @relates config_value
/// @relates config_value
template
<
class
T
>
template
<
class
T
>
expected
<
T
>
get_as
(
const
config_value
&
value
)
{
expected
<
T
>
get_as
(
const
config_value
&
value
)
{
if
constexpr
(
std
::
is_same
<
T
,
timespan
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
T
,
timespan
>
)
{
return
value
.
to_timespan
();
return
value
.
to_timespan
();
}
else
if
constexpr
(
std
::
is_same
<
T
,
config_value
::
list
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
config_value
::
list
>
)
{
return
value
.
to_list
();
return
value
.
to_list
();
}
else
if
constexpr
(
std
::
is_same
<
T
,
config_value
::
dictionary
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
config_value
::
dictionary
>
)
{
return
value
.
to_dictionary
();
return
value
.
to_dictionary
();
}
else
if
constexpr
(
std
::
is_same
<
T
,
uri
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
uri
>
)
{
return
value
.
to_uri
();
return
value
.
to_uri
();
}
else
{
}
else
{
auto
token
=
inspect_access_type
<
config_value_reader
,
T
>
();
auto
token
=
inspect_access_type
<
config_value_reader
,
T
>
();
...
@@ -550,7 +550,7 @@ struct get_or_auto_deduce {};
...
@@ -550,7 +550,7 @@ struct get_or_auto_deduce {};
/// @relates config_value
/// @relates config_value
template
<
class
To
=
get_or_auto_deduce
,
class
Fallback
>
template
<
class
To
=
get_or_auto_deduce
,
class
Fallback
>
auto
get_or
(
const
config_value
&
x
,
Fallback
&&
fallback
)
{
auto
get_or
(
const
config_value
&
x
,
Fallback
&&
fallback
)
{
if
constexpr
(
std
::
is_same
<
To
,
get_or_auto_deduce
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
To
,
get_or_auto_deduce
>
)
{
using
guide
=
get_or_deduction_guide
<
std
::
decay_t
<
Fallback
>>
;
using
guide
=
get_or_deduction_guide
<
std
::
decay_t
<
Fallback
>>
;
using
value_type
=
typename
guide
::
value_type
;
using
value_type
=
typename
guide
::
value_type
;
if
(
auto
val
=
get_as
<
value_type
>
(
x
))
if
(
auto
val
=
get_as
<
value_type
>
(
x
))
...
...
libcaf_core/caf/config_value_reader.cpp
View file @
59a85143
...
@@ -440,7 +440,7 @@ bool pull(config_value_reader& reader, T& x) {
...
@@ -440,7 +440,7 @@ bool pull(config_value_reader& reader, T& x) {
}
}
}
else
if
(
holds_alternative
<
config_value_reader
::
key_ptr
>
(
top
))
{
}
else
if
(
holds_alternative
<
config_value_reader
::
key_ptr
>
(
top
))
{
auto
ptr
=
get
<
config_value_reader
::
key_ptr
>
(
top
);
auto
ptr
=
get
<
config_value_reader
::
key_ptr
>
(
top
);
if
constexpr
(
std
::
is_same
<
std
::
string
,
T
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
std
::
string
,
T
>
)
{
x
=
*
ptr
;
x
=
*
ptr
;
reader
.
pop
();
reader
.
pop
();
return
true
;
return
true
;
...
...
libcaf_core/caf/config_value_writer.cpp
View file @
59a85143
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#define SCOPE(top_type) \
#define SCOPE(top_type) \
CHECK_NOT_EMPTY(); \
CHECK_NOT_EMPTY(); \
if (!holds_alternative<top_type>(st_.top())) { \
if (!holds_alternative<top_type>(st_.top())) { \
if constexpr (std::is_same
<top_type, settings*>::value) {
\
if constexpr (std::is_same
_v<top_type, settings*>) {
\
emplace_error(sec::runtime_error, \
emplace_error(sec::runtime_error, \
"attempted to add list items before calling " \
"attempted to add list items before calling " \
"begin_sequence or begin_tuple"); \
"begin_sequence or begin_tuple"); \
...
...
libcaf_core/caf/detail/behavior_impl.hpp
View file @
59a85143
...
@@ -119,7 +119,7 @@ public:
...
@@ -119,7 +119,7 @@ public:
if
(
arg_types
==
msg
.
types
())
{
if
(
arg_types
==
msg
.
types
())
{
typename
trait
::
message_view_type
xs
{
msg
};
typename
trait
::
message_view_type
xs
{
msg
};
using
fun_result
=
decltype
(
detail
::
apply_args
(
fun
,
xs
));
using
fun_result
=
decltype
(
detail
::
apply_args
(
fun
,
xs
));
if
constexpr
(
std
::
is_same
<
void
,
fun_result
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
void
,
fun_result
>
)
{
detail
::
apply_args
(
fun
,
xs
);
detail
::
apply_args
(
fun
,
xs
);
f
(
unit
);
f
(
unit
);
}
else
{
}
else
{
...
...
libcaf_core/caf/detail/config_consumer.cpp
View file @
59a85143
...
@@ -106,7 +106,7 @@ void config_consumer::destroy() {
...
@@ -106,7 +106,7 @@ void config_consumer::destroy() {
void
config_consumer
::
end_map
()
{
void
config_consumer
::
end_map
()
{
auto
f
=
[
this
](
auto
ptr
)
{
auto
f
=
[
this
](
auto
ptr
)
{
if
constexpr
(
std
::
is_same
<
none_t
,
decltype
(
ptr
)
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
none_t
,
decltype
(
ptr
)
>
)
{
// nop
// nop
}
else
{
}
else
{
ptr
->
value
(
std
::
move
(
*
cfg_
));
ptr
->
value
(
std
::
move
(
*
cfg_
));
...
...
libcaf_core/caf/detail/mtl_util.hpp
View file @
59a85143
...
@@ -42,7 +42,7 @@ struct mtl_util<result<Rs...>(Ts...)> {
...
@@ -42,7 +42,7 @@ struct mtl_util<result<Rs...>(Ts...)> {
OnError
&
on_error
,
Ts
...
xs
)
{
OnError
&
on_error
,
Ts
...
xs
)
{
f
.
revert
();
f
.
revert
();
if
(
adapter
.
read
(
f
,
xs
...))
{
if
(
adapter
.
read
(
f
,
xs
...))
{
if
constexpr
(
std
::
is_same
<
type_list
<
Rs
...
>
,
type_list
<
void
>>::
value
)
if
constexpr
(
std
::
is_same
_v
<
type_list
<
Rs
...
>
,
type_list
<
void
>>
)
self
->
request
(
dst
,
timeout
,
std
::
move
(
xs
)...)
self
->
request
(
dst
,
timeout
,
std
::
move
(
xs
)...)
.
then
([
f
{
std
::
move
(
on_result
)}]()
mutable
{
f
();
},
.
then
([
f
{
std
::
move
(
on_result
)}]()
mutable
{
f
();
},
std
::
move
(
on_error
));
std
::
move
(
on_error
));
...
...
libcaf_core/caf/detail/parser/fsm.hpp
View file @
59a85143
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
#define CAF_FSM_EVAL_ACTION(action) \
#define CAF_FSM_EVAL_ACTION(action) \
auto action_impl = [&]() -> decltype(auto) { return action; }; \
auto action_impl = [&]() -> decltype(auto) { return action; }; \
if constexpr (std::is_same
<pec, decltype(action_impl())>::value) {
\
if constexpr (std::is_same
_v<pec, decltype(action_impl())>) {
\
if (auto code = action_impl(); code != pec::success) { \
if (auto code = action_impl(); code != pec::success) { \
ps.code = code; \
ps.code = code; \
return; \
return; \
...
...
libcaf_core/caf/detail/parser/read_string.hpp
View file @
59a85143
...
@@ -24,11 +24,10 @@ template <class State, class Consumer>
...
@@ -24,11 +24,10 @@ template <class State, class Consumer>
void
read_string
(
State
&
ps
,
Consumer
&&
consumer
)
{
void
read_string
(
State
&
ps
,
Consumer
&&
consumer
)
{
// Allow Consumer to be a string&, in which case we simply store the result
// Allow Consumer to be a string&, in which case we simply store the result
// directly in the reference.
// directly in the reference.
using
res_type
using
res_type
=
std
::
conditional_t
<
std
::
is_same_v
<
Consumer
,
std
::
string
&>
,
=
std
::
conditional_t
<
std
::
is_same
<
Consumer
,
std
::
string
&>::
value
,
std
::
string
&
,
std
::
string
>
;
std
::
string
&
,
std
::
string
>
;
auto
init_res
=
[](
auto
&
c
)
->
res_type
{
auto
init_res
=
[](
auto
&
c
)
->
res_type
{
if
constexpr
(
std
::
is_same
<
res_type
,
std
::
string
&>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
res_type
,
std
::
string
&>
)
{
c
.
clear
();
c
.
clear
();
return
c
;
return
c
;
}
else
{
}
else
{
...
@@ -37,7 +36,7 @@ void read_string(State& ps, Consumer&& consumer) {
...
@@ -37,7 +36,7 @@ void read_string(State& ps, Consumer&& consumer) {
};
};
res_type
res
=
init_res
(
consumer
);
res_type
res
=
init_res
(
consumer
);
auto
g
=
caf
::
detail
::
make_scope_guard
([
&
]
{
auto
g
=
caf
::
detail
::
make_scope_guard
([
&
]
{
if
constexpr
(
std
::
is_same
<
res_type
,
std
::
string
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
res_type
,
std
::
string
>
)
if
(
ps
.
code
<=
pec
::
trailing_character
)
if
(
ps
.
code
<=
pec
::
trailing_character
)
consumer
.
value
(
std
::
move
(
res
));
consumer
.
value
(
std
::
move
(
res
));
});
});
...
...
libcaf_core/caf/detail/profiled_send.hpp
View file @
59a85143
...
@@ -38,7 +38,7 @@ disposable profiled_send(Self* self, SelfHandle&& src, const Handle& dst,
...
@@ -38,7 +38,7 @@ disposable profiled_send(Self* self, SelfHandle&& src, const Handle& dst,
actor_clock
&
clock
,
actor_clock
::
time_point
timeout
,
actor_clock
&
clock
,
actor_clock
::
time_point
timeout
,
[[
maybe_unused
]]
message_id
msg_id
,
Ts
&&
...
xs
)
{
[[
maybe_unused
]]
message_id
msg_id
,
Ts
&&
...
xs
)
{
if
(
dst
)
{
if
(
dst
)
{
if
constexpr
(
std
::
is_same
<
Handle
,
group
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
Handle
,
group
>
)
{
return
clock
.
schedule_message
(
timeout
,
dst
,
std
::
forward
<
SelfHandle
>
(
src
),
return
clock
.
schedule_message
(
timeout
,
dst
,
std
::
forward
<
SelfHandle
>
(
src
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
}
else
{
}
else
{
...
...
libcaf_core/caf/detail/set_thread_name.cpp
View file @
59a85143
...
@@ -26,7 +26,7 @@ void set_thread_name(const char* name) {
...
@@ -26,7 +26,7 @@ void set_thread_name(const char* name) {
#ifdef CAF_WINDOWS
#ifdef CAF_WINDOWS
// nop
// nop
#else // CAF_WINDOWS
#else // CAF_WINDOWS
static_assert
(
std
::
is_same
<
std
::
thread
::
native_handle_type
,
pthread_t
>::
value
,
static_assert
(
std
::
is_same
_v
<
std
::
thread
::
native_handle_type
,
pthread_t
>
,
"std::thread not based on pthread_t"
);
"std::thread not based on pthread_t"
);
# if defined(CAF_MACOS)
# if defined(CAF_MACOS)
pthread_setname_np
(
name
);
pthread_setname_np
(
name
);
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
59a85143
...
@@ -172,9 +172,9 @@ public:
...
@@ -172,9 +172,9 @@ public:
sep
();
sep
();
result_
+=
"null"
;
result_
+=
"null"
;
return
true
;
return
true
;
}
else
if
constexpr
(
std
::
is_same
<
T
,
char
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
char
>
)
{
return
value
(
std
::
string_view
{
x
,
strlen
(
x
)});
return
value
(
std
::
string_view
{
x
,
strlen
(
x
)});
}
else
if
constexpr
(
std
::
is_same
<
T
,
void
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
void
>
)
{
sep
();
sep
();
result_
+=
"*<"
;
result_
+=
"*<"
;
auto
addr
=
reinterpret_cast
<
intptr_t
>
(
x
);
auto
addr
=
reinterpret_cast
<
intptr_t
>
(
x
);
...
@@ -218,7 +218,7 @@ public:
...
@@ -218,7 +218,7 @@ public:
template
<
class
T
>
template
<
class
T
>
static
std
::
string
render
(
const
T
&
x
)
{
static
std
::
string
render
(
const
T
&
x
)
{
if
constexpr
(
std
::
is_same
<
std
::
nullptr_t
,
T
>::
value
)
{
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
<
std
::
string_view
,
T
>::
value
)
{
if
constexpr
(
std
::
is_pointer
<
T
>::
value
)
{
if
constexpr
(
std
::
is_pointer
<
T
>::
value
)
{
...
...
libcaf_core/caf/detail/type_list.hpp
View file @
59a85143
...
@@ -386,8 +386,7 @@ constexpr size_t tl_count<List, Pred>::value;
...
@@ -386,8 +386,7 @@ constexpr size_t tl_count<List, Pred>::value;
/// Counts the number of elements in the list which are equal to `T`.
/// Counts the number of elements in the list which are equal to `T`.
template
<
class
List
,
class
T
>
template
<
class
List
,
class
T
>
struct
tl_count_type
{
struct
tl_count_type
{
static
constexpr
size_t
value
=
(
std
::
is_same
<
tl_head_t
<
List
>
,
T
>::
value
?
1
static
constexpr
size_t
value
=
(
std
::
is_same_v
<
tl_head_t
<
List
>
,
T
>
?
1
:
0
)
:
0
)
+
tl_count_type
<
tl_tail_t
<
List
>
,
T
>::
value
;
+
tl_count_type
<
tl_tail_t
<
List
>
,
T
>::
value
;
};
};
...
@@ -676,8 +675,8 @@ struct tl_filter_type;
...
@@ -676,8 +675,8 @@ struct tl_filter_type;
template
<
class
Type
,
class
...
T
>
template
<
class
Type
,
class
...
T
>
struct
tl_filter_type
<
type_list
<
T
...
>
,
Type
>
{
struct
tl_filter_type
<
type_list
<
T
...
>
,
Type
>
{
using
type
=
typename
tl_filter_impl
<
type_list
<
T
...
>
,
using
type
=
!
std
::
is_same
<
T
,
Type
>::
value
...
>::
type
;
typename
tl_filter_impl
<
type_list
<
T
...
>
,
!
std
::
is_same_v
<
T
,
Type
>
...
>::
type
;
};
};
template
<
class
List
,
class
T
>
template
<
class
List
,
class
T
>
...
@@ -690,9 +689,8 @@ struct tl_filter_not_type;
...
@@ -690,9 +689,8 @@ struct tl_filter_not_type;
template
<
class
Type
,
class
...
T
>
template
<
class
Type
,
class
...
T
>
struct
tl_filter_not_type
<
type_list
<
T
...
>
,
Type
>
{
struct
tl_filter_not_type
<
type_list
<
T
...
>
,
Type
>
{
using
type
=
using
type
=
typename
tl_filter_impl
<
type_list
<
T
...
>
,
typename
tl_filter_impl
<
type_list
<
T
...
>
,
(
!
std
::
is_same_v
<
T
,
Type
>
)
...
>::
type
;
(
!
std
::
is_same
<
T
,
Type
>::
value
)...
>::
type
;
};
};
template
<
class
List
,
class
T
>
template
<
class
List
,
class
T
>
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
59a85143
...
@@ -172,7 +172,7 @@ class is_comparable {
...
@@ -172,7 +172,7 @@ class is_comparable {
&&
std
::
is_arithmetic
<
T2
>::
value
>
{}));
&&
std
::
is_arithmetic
<
T2
>::
value
>
{}));
public:
public:
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
static
constexpr
bool
value
=
std
::
is_same
_v
<
bool
,
result_type
>
;
};
};
/// Checks whether `T` behaves like a forward iterator.
/// Checks whether `T` behaves like a forward iterator.
...
@@ -194,7 +194,7 @@ class is_forward_iterator {
...
@@ -194,7 +194,7 @@ class is_forward_iterator {
using
result_type
=
decltype
(
sfinae
(
std
::
declval
<
T
&>
(),
std
::
declval
<
T
&>
()));
using
result_type
=
decltype
(
sfinae
(
std
::
declval
<
T
&>
(),
std
::
declval
<
T
&>
()));
public:
public:
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
static
constexpr
bool
value
=
std
::
is_same
_v
<
bool
,
result_type
>
;
};
};
/// Checks whether `T` has `begin()` and `end()` member
/// Checks whether `T` has `begin()` and `end()` member
...
@@ -217,7 +217,7 @@ class is_iterable {
...
@@ -217,7 +217,7 @@ class is_iterable {
public:
public:
static
constexpr
bool
value
=
is_primitive
<
T
>::
value
==
false
static
constexpr
bool
value
=
is_primitive
<
T
>::
value
==
false
&&
std
::
is_same
<
bool
,
result_type
>::
value
;
&&
std
::
is_same
_v
<
bool
,
result_type
>
;
};
};
template
<
class
T
>
template
<
class
T
>
...
@@ -363,7 +363,7 @@ struct is_callable {
...
@@ -363,7 +363,7 @@ struct is_callable {
using
result_type
=
decltype
(
_fun
(
static_cast
<
decay_t
<
T
>*>
(
nullptr
)));
using
result_type
=
decltype
(
_fun
(
static_cast
<
decay_t
<
T
>*>
(
nullptr
)));
public:
public:
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
static
constexpr
bool
value
=
std
::
is_same
_v
<
bool
,
result_type
>
;
};
};
/// Checks whether `F` is callable with arguments of types `Ts...`.
/// Checks whether `F` is callable with arguments of types `Ts...`.
...
@@ -552,8 +552,8 @@ constexpr bool is_expected_v = is_expected<T>::value;
...
@@ -552,8 +552,8 @@ constexpr bool is_expected_v = is_expected<T>::value;
template
<
class
T
,
class
U
,
template
<
class
T
,
class
U
,
bool
Enable
=
std
::
is_integral
<
T
>
::
value
bool
Enable
=
std
::
is_integral
<
T
>
::
value
&&
std
::
is_integral
<
U
>::
value
&&
std
::
is_integral
<
U
>::
value
&&
!
std
::
is_same
<
T
,
bool
>::
value
&&
!
std
::
is_same
_v
<
T
,
bool
>
&&
!
std
::
is_same
<
U
,
bool
>::
value
>
&&
!
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
)
...
@@ -569,7 +569,7 @@ struct is_equal_int_type<T, U, false> : std::false_type {};
...
@@ -569,7 +569,7 @@ struct is_equal_int_type<T, U, false> : std::false_type {};
/// same size and signedness. This works around the issue that
/// same size and signedness. This works around the issue that
/// `uint8_t != unsigned char on some compilers.
/// `uint8_t != unsigned char on some compilers.
template
<
class
T
,
typename
U
>
template
<
class
T
,
typename
U
>
struct
is_same_ish
:
std
::
conditional
<
std
::
is_same
<
T
,
U
>::
value
,
std
::
true_type
,
struct
is_same_ish
:
std
::
conditional
<
std
::
is_same
_v
<
T
,
U
>
,
std
::
true_type
,
is_equal_int_type
<
T
,
U
>>::
type
{};
is_equal_int_type
<
T
,
U
>>::
type
{};
/// Utility for fallbacks calling `static_assert`.
/// Utility for fallbacks calling `static_assert`.
...
@@ -878,8 +878,7 @@ private:
...
@@ -878,8 +878,7 @@ private:
using
result_type
=
decltype
(
sfinae
(
std
::
declval
<
Inspector
&>
()));
using
result_type
=
decltype
(
sfinae
(
std
::
declval
<
Inspector
&>
()));
public:
public:
static
constexpr
bool
value
static
constexpr
bool
value
=
std
::
is_same_v
<
result_type
,
execution_unit
*>
;
=
std
::
is_same
<
result_type
,
execution_unit
*>::
value
;
};
};
/// Checks whether `T` provides an `inspect` overload for `Inspector`.
/// Checks whether `T` provides an `inspect` overload for `Inspector`.
...
...
libcaf_core/caf/detail/typed_actor_util.hpp
View file @
59a85143
...
@@ -39,9 +39,9 @@ struct type_checker {
...
@@ -39,9 +39,9 @@ struct type_checker {
static
void
check
()
{
static
void
check
()
{
using
arg_types
=
typename
tl_map
<
typename
get_callable_trait
<
F
>::
arg_types
,
using
arg_types
=
typename
tl_map
<
typename
get_callable_trait
<
F
>::
arg_types
,
std
::
decay
>::
type
;
std
::
decay
>::
type
;
static_assert
(
std
::
is_same
<
Output
,
arg_types
>::
value
static_assert
(
std
::
is_same
_v
<
Output
,
arg_types
>
||
(
std
::
is_same
<
Output
,
type_list
<
void
>>::
value
||
(
std
::
is_same
_v
<
Output
,
type_list
<
void
>>
&&
std
::
is_same
<
arg_types
,
type_list
<>>::
value
),
&&
std
::
is_same
_v
<
arg_types
,
type_list
<>>
),
"wrong functor signature"
);
"wrong functor signature"
);
}
}
};
};
...
...
libcaf_core/caf/error_code.hpp
View file @
59a85143
...
@@ -23,7 +23,7 @@ public:
...
@@ -23,7 +23,7 @@ public:
static_assert
(
is_error_code_enum_v
<
Enum
>
);
static_assert
(
is_error_code_enum_v
<
Enum
>
);
static_assert
(
std
::
is_same
<
underlying_type
,
uint8_t
>::
value
);
static_assert
(
std
::
is_same
_v
<
underlying_type
,
uint8_t
>
);
constexpr
error_code
()
noexcept
:
value_
(
static_cast
<
Enum
>
(
0
))
{
constexpr
error_code
()
noexcept
:
value_
(
static_cast
<
Enum
>
(
0
))
{
// nop
// nop
...
...
libcaf_core/caf/exec_main.hpp
View file @
59a85143
...
@@ -66,7 +66,7 @@ int exec_main(F fun, int argc, char** argv) {
...
@@ -66,7 +66,7 @@ int exec_main(F fun, int argc, char** argv) {
"main function must take actor_system& as first parameter"
);
"main function must take actor_system& as first parameter"
);
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
<
arg2
,
unit_t
>::
value
static_assert
(
std
::
is_same
_v
<
arg2
,
unit_t
>
||
(
std
::
is_base_of
<
actor_system_config
,
decayed_arg2
>::
value
||
(
std
::
is_base_of
<
actor_system_config
,
decayed_arg2
>::
value
&&
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 "
...
...
libcaf_core/caf/inspector_access.hpp
View file @
59a85143
...
@@ -53,9 +53,9 @@ constexpr bool assertion_failed_v = false;
...
@@ -53,9 +53,9 @@ constexpr bool assertion_failed_v = false;
template
<
class
Inspector
,
class
Set
,
class
ValueType
>
template
<
class
Inspector
,
class
Set
,
class
ValueType
>
auto
bind_setter
(
Inspector
&
f
,
Set
&
set
,
ValueType
&
tmp
)
{
auto
bind_setter
(
Inspector
&
f
,
Set
&
set
,
ValueType
&
tmp
)
{
using
set_result_type
=
decltype
(
set
(
std
::
move
(
tmp
)));
using
set_result_type
=
decltype
(
set
(
std
::
move
(
tmp
)));
if
constexpr
(
std
::
is_same
<
set_result_type
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
set_result_type
,
bool
>
)
{
return
[
&
]
{
return
set
(
std
::
move
(
tmp
));
};
return
[
&
]
{
return
set
(
std
::
move
(
tmp
));
};
}
else
if
constexpr
(
std
::
is_same
<
set_result_type
,
error
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
set_result_type
,
error
>
)
{
return
[
&
]
{
return
[
&
]
{
if
(
auto
err
=
set
(
std
::
move
(
tmp
));
!
err
)
{
if
(
auto
err
=
set
(
std
::
move
(
tmp
));
!
err
)
{
return
true
;
return
true
;
...
@@ -65,7 +65,7 @@ auto bind_setter(Inspector& f, Set& set, ValueType& tmp) {
...
@@ -65,7 +65,7 @@ auto bind_setter(Inspector& f, Set& set, ValueType& tmp) {
}
}
};
};
}
else
{
}
else
{
static_assert
(
std
::
is_same
<
set_result_type
,
void
>::
value
,
static_assert
(
std
::
is_same
_v
<
set_result_type
,
void
>
,
"a setter must return caf::error, bool or void"
);
"a setter must return caf::error, bool or void"
);
return
[
&
]
{
return
[
&
]
{
set
(
std
::
move
(
tmp
));
set
(
std
::
move
(
tmp
));
...
...
libcaf_core/caf/load_inspector.hpp
View file @
59a85143
...
@@ -282,7 +282,7 @@ public:
...
@@ -282,7 +282,7 @@ public:
using
load_callback_result
=
decltype
(
load_callback
());
using
load_callback_result
=
decltype
(
load_callback
());
if
(
!
(
f
->
begin_object
(
object_type
,
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
if
(
!
(
f
->
begin_object
(
object_type
,
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
return
false
;
return
false
;
if
constexpr
(
std
::
is_same
<
load_callback_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
load_callback_result
,
bool
>
)
{
if
(
!
load_callback
())
{
if
(
!
load_callback
())
{
f
->
set_error
(
sec
::
load_callback_failed
);
f
->
set_error
(
sec
::
load_callback_failed
);
return
false
;
return
false
;
...
@@ -351,11 +351,11 @@ public:
...
@@ -351,11 +351,11 @@ public:
static
auto
field
(
std
::
string_view
name
,
Get
get
,
Set
set
)
{
static
auto
field
(
std
::
string_view
name
,
Get
get
,
Set
set
)
{
using
field_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
field_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
setter_result
=
decltype
(
set
(
std
::
declval
<
field_type
&&>
()));
using
setter_result
=
decltype
(
set
(
std
::
declval
<
field_type
&&>
()));
if
constexpr
(
std
::
is_same
<
setter_result
,
error
>::
value
if
constexpr
(
std
::
is_same
_v
<
setter_result
,
error
>
||
std
::
is_same
<
setter_result
,
bool
>::
value
)
{
||
std
::
is_same
_v
<
setter_result
,
bool
>
)
{
return
virt_field_t
<
field_type
,
Set
>
{
name
,
std
::
move
(
set
)};
return
virt_field_t
<
field_type
,
Set
>
{
name
,
std
::
move
(
set
)};
}
else
{
}
else
{
static_assert
(
std
::
is_same
<
setter_result
,
void
>::
value
,
static_assert
(
std
::
is_same
_v
<
setter_result
,
void
>
,
"a setter must return caf::error, bool or void"
);
"a setter must return caf::error, bool or void"
);
auto
set_fun
=
[
f
{
std
::
move
(
set
)}](
field_type
&&
val
)
{
auto
set_fun
=
[
f
{
std
::
move
(
set
)}](
field_type
&&
val
)
{
f
(
std
::
move
(
val
));
f
(
std
::
move
(
val
));
...
@@ -371,13 +371,13 @@ public:
...
@@ -371,13 +371,13 @@ public:
field
(
std
::
string_view
name
,
IsPresent
&&
,
Get
&&
get
,
Reset
reset
,
Set
set
)
{
field
(
std
::
string_view
name
,
IsPresent
&&
,
Get
&&
get
,
Reset
reset
,
Set
set
)
{
using
field_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
field_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
setter_result
=
decltype
(
set
(
std
::
declval
<
field_type
&&>
()));
using
setter_result
=
decltype
(
set
(
std
::
declval
<
field_type
&&>
()));
if
constexpr
(
std
::
is_same
<
setter_result
,
error
>::
value
if
constexpr
(
std
::
is_same
_v
<
setter_result
,
error
>
||
std
::
is_same
<
setter_result
,
bool
>::
value
)
{
||
std
::
is_same
_v
<
setter_result
,
bool
>
)
{
return
optional_virt_field_t
<
field_type
,
Reset
,
Set
>
{
name
,
return
optional_virt_field_t
<
field_type
,
Reset
,
Set
>
{
name
,
std
::
move
(
reset
),
std
::
move
(
reset
),
std
::
move
(
set
)};
std
::
move
(
set
)};
}
else
{
}
else
{
static_assert
(
std
::
is_same
<
setter_result
,
void
>::
value
,
static_assert
(
std
::
is_same
_v
<
setter_result
,
void
>
,
"a setter must return caf::error, bool or void"
);
"a setter must return caf::error, bool or void"
);
auto
set_fun
=
[
f
{
std
::
move
(
set
)}](
field_type
&&
val
)
{
auto
set_fun
=
[
f
{
std
::
move
(
set
)}](
field_type
&&
val
)
{
f
(
std
::
move
(
val
));
f
(
std
::
move
(
val
));
...
...
libcaf_core/caf/load_inspector_base.hpp
View file @
59a85143
...
@@ -115,7 +115,7 @@ public:
...
@@ -115,7 +115,7 @@ public:
using
value_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
value_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
auto
tmp
=
value_type
{};
auto
tmp
=
value_type
{};
using
setter_result
=
decltype
(
set
(
std
::
move
(
tmp
)));
using
setter_result
=
decltype
(
set
(
std
::
move
(
tmp
)));
if
constexpr
(
std
::
is_same
<
setter_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
setter_result
,
bool
>
)
{
if
(
dref
().
apply
(
tmp
))
{
if
(
dref
().
apply
(
tmp
))
{
if
(
set
(
std
::
move
(
tmp
)))
{
if
(
set
(
std
::
move
(
tmp
)))
{
return
true
;
return
true
;
...
@@ -126,7 +126,7 @@ public:
...
@@ -126,7 +126,7 @@ public:
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
else
if
constexpr
(
std
::
is_same
<
setter_result
,
void
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
setter_result
,
void
>
)
{
if
(
dref
().
apply
(
tmp
))
{
if
(
dref
().
apply
(
tmp
))
{
set
(
std
::
move
(
tmp
));
set
(
std
::
move
(
tmp
));
return
true
;
return
true
;
...
...
libcaf_core/caf/message.hpp
View file @
59a85143
...
@@ -181,7 +181,7 @@ public:
...
@@ -181,7 +181,7 @@ public:
private:
private:
template
<
size_t
Pos
,
class
T
>
template
<
size_t
Pos
,
class
T
>
bool
matches_at
(
const
T
&
value
)
const
{
bool
matches_at
(
const
T
&
value
)
const
{
if
constexpr
(
std
::
is_same
<
T
,
decltype
(
std
::
ignore
)
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
T
,
decltype
(
std
::
ignore
)
>
)
return
true
;
return
true
;
else
else
return
match_element
<
T
>
(
Pos
)
&&
get_as
<
T
>
(
Pos
)
==
value
;
return
match_element
<
T
>
(
Pos
)
&&
get_as
<
T
>
(
Pos
)
==
value
;
...
...
libcaf_core/caf/mixin/sender.hpp
View file @
59a85143
...
@@ -67,7 +67,7 @@ public:
...
@@ -67,7 +67,7 @@ public:
/// Sends `{xs...}` as an asynchronous message to `dest` with priority `mp`.
/// Sends `{xs...}` as an asynchronous message to `dest` with priority `mp`.
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
,
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
,
class
...
Ts
>
class
...
Ts
>
detail
::
enable_if_t
<!
std
::
is_same
<
group
,
Dest
>::
value
>
detail
::
enable_if_t
<!
std
::
is_same
_v
<
group
,
Dest
>
>
send
(
const
Dest
&
dest
,
Ts
&&
...
xs
)
{
send
(
const
Dest
&
dest
,
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
((
detail
::
sendable
<
Ts
>
&&
...),
static_assert
((
detail
::
sendable
<
Ts
>
&&
...),
...
@@ -99,7 +99,7 @@ public:
...
@@ -99,7 +99,7 @@ public:
/// passed already).
/// passed already).
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
=
actor
,
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
=
actor
,
class
...
Ts
>
class
...
Ts
>
detail
::
enable_if_t
<!
std
::
is_same
<
Dest
,
group
>::
value
,
disposable
>
detail
::
enable_if_t
<!
std
::
is_same
_v
<
Dest
,
group
>
,
disposable
>
scheduled_send
(
const
Dest
&
dest
,
actor_clock
::
time_point
timeout
,
scheduled_send
(
const
Dest
&
dest
,
actor_clock
::
time_point
timeout
,
Ts
&&
...
xs
)
{
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
@@ -139,7 +139,7 @@ public:
...
@@ -139,7 +139,7 @@ public:
/// Sends a message after a relative timeout.
/// Sends a message after a relative timeout.
template
<
message_priority
P
=
message_priority
::
normal
,
class
Rep
=
int
,
template
<
message_priority
P
=
message_priority
::
normal
,
class
Rep
=
int
,
class
Period
=
std
::
ratio
<
1
>,
class
Dest
=
actor
,
class
...
Ts
>
class
Period
=
std
::
ratio
<
1
>,
class
Dest
=
actor
,
class
...
Ts
>
detail
::
enable_if_t
<!
std
::
is_same
<
Dest
,
group
>::
value
,
disposable
>
detail
::
enable_if_t
<!
std
::
is_same
_v
<
Dest
,
group
>
,
disposable
>
delayed_send
(
const
Dest
&
dest
,
std
::
chrono
::
duration
<
Rep
,
Period
>
rel_timeout
,
delayed_send
(
const
Dest
&
dest
,
std
::
chrono
::
duration
<
Rep
,
Period
>
rel_timeout
,
Ts
&&
...
xs
)
{
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
...
libcaf_core/caf/mtl.hpp
View file @
59a85143
...
@@ -80,7 +80,7 @@ public:
...
@@ -80,7 +80,7 @@ public:
bool
try_request
(
const
typed_actor
<
Fs
...
>&
dst
,
Timeout
timeout
,
bool
try_request
(
const
typed_actor
<
Fs
...
>&
dst
,
Timeout
timeout
,
OnResult
on_result
,
OnError
on_error
)
{
OnResult
on_result
,
OnError
on_error
)
{
using
on_error_result
=
decltype
(
on_error
(
std
::
declval
<
error
&>
()));
using
on_error_result
=
decltype
(
on_error
(
std
::
declval
<
error
&>
()));
static_assert
(
std
::
is_same
<
void
,
on_error_result
>::
value
);
static_assert
(
std
::
is_same
_v
<
void
,
on_error_result
>
);
auto
dst_hdl
=
actor_cast
<
actor
>
(
dst
);
auto
dst_hdl
=
actor_cast
<
actor
>
(
dst
);
return
(
detail
::
mtl_util
<
Fs
>::
request
(
self_
,
dst_hdl
,
timeout
,
adapter_
,
return
(
detail
::
mtl_util
<
Fs
>::
request
(
self_
,
dst_hdl
,
timeout
,
adapter_
,
*
reader_
,
on_result
,
on_error
)
*
reader_
,
on_result
,
on_error
)
...
...
libcaf_core/caf/node_id.cpp
View file @
59a85143
...
@@ -165,7 +165,7 @@ bool node_id::can_parse(std::string_view str) noexcept {
...
@@ -165,7 +165,7 @@ bool node_id::can_parse(std::string_view str) noexcept {
void
append_to_string
(
std
::
string
&
str
,
const
node_id
&
x
)
{
void
append_to_string
(
std
::
string
&
str
,
const
node_id
&
x
)
{
auto
f
=
[
&
str
](
auto
&
x
)
{
auto
f
=
[
&
str
](
auto
&
x
)
{
if
constexpr
(
std
::
is_same
<
std
::
decay_t
<
decltype
(
x
)
>
,
uri
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
std
::
decay_t
<
decltype
(
x
)
>
,
uri
>
)
str
.
insert
(
str
.
end
(),
x
.
str
().
begin
(),
x
.
str
().
end
());
str
.
insert
(
str
.
end
(),
x
.
str
().
begin
(),
x
.
str
().
end
());
else
else
x
.
print
(
str
);
x
.
print
(
str
);
...
...
libcaf_core/caf/response_handle.hpp
View file @
59a85143
...
@@ -65,7 +65,7 @@ public:
...
@@ -65,7 +65,7 @@ public:
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide an operator() that takes a caf::error"
);
"OnError must provide an operator() that takes a caf::error"
);
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
static_assert
(
std
::
is_same
_v
<
void
,
result_type
>
,
"response handlers are not allowed to have a return "
"response handlers are not allowed to have a return "
"type other than void"
);
"type other than void"
);
policy_type
::
template
type_checker
<
F
>
::
check
();
policy_type
::
template
type_checker
<
F
>
::
check
();
...
@@ -90,7 +90,7 @@ public:
...
@@ -90,7 +90,7 @@ public:
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide an operator() that takes a caf::error"
);
"OnError must provide an operator() that takes a caf::error"
);
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
static_assert
(
std
::
is_same
_v
<
void
,
result_type
>
,
"response handlers are not allowed to have a return "
"response handlers are not allowed to have a return "
"type other than void"
);
"type other than void"
);
policy_type
::
template
type_checker
<
F
>
::
check
();
policy_type
::
template
type_checker
<
F
>
::
check
();
...
@@ -129,7 +129,7 @@ public:
...
@@ -129,7 +129,7 @@ public:
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide an operator() that takes a caf::error"
);
"OnError must provide an operator() that takes a caf::error"
);
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
static_assert
(
std
::
is_same
_v
<
void
,
result_type
>
,
"response handlers are not allowed to have a return "
"response handlers are not allowed to have a return "
"type other than void"
);
"type other than void"
);
policy_type
::
template
type_checker
<
F
>
::
check
();
policy_type
::
template
type_checker
<
F
>
::
check
();
...
...
libcaf_core/caf/response_promise.hpp
View file @
59a85143
...
@@ -117,8 +117,7 @@ public:
...
@@ -117,8 +117,7 @@ public:
void
deliver
(
expected
<
T
>
x
)
{
void
deliver
(
expected
<
T
>
x
)
{
if
(
pending
())
{
if
(
pending
())
{
if
(
x
)
{
if
(
x
)
{
if
constexpr
(
std
::
is_same
<
T
,
void
>::
value
if
constexpr
(
std
::
is_same_v
<
T
,
void
>
||
std
::
is_same_v
<
T
,
unit_t
>
)
||
std
::
is_same
<
T
,
unit_t
>::
value
)
state_
->
deliver_impl
(
make_message
());
state_
->
deliver_impl
(
make_message
());
else
else
state_
->
deliver_impl
(
make_message
(
std
::
move
(
*
x
)));
state_
->
deliver_impl
(
make_message
(
std
::
move
(
*
x
)));
...
...
libcaf_core/caf/resumable.hpp
View file @
59a85143
...
@@ -61,14 +61,14 @@ public:
...
@@ -61,14 +61,14 @@ public:
// enables intrusive_ptr<resumable> without introducing ambiguity
// enables intrusive_ptr<resumable> without introducing ambiguity
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_same
<
T
*
,
resumable
*>::
value
>::
type
typename
std
::
enable_if
<
std
::
is_same
_v
<
T
*
,
resumable
*>
>::
type
intrusive_ptr_add_ref
(
T
*
ptr
)
{
intrusive_ptr_add_ref
(
T
*
ptr
)
{
ptr
->
intrusive_ptr_add_ref_impl
();
ptr
->
intrusive_ptr_add_ref_impl
();
}
}
// enables intrusive_ptr<resumable> without introducing ambiguity
// enables intrusive_ptr<resumable> without introducing ambiguity
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_same
<
T
*
,
resumable
*>::
value
>::
type
typename
std
::
enable_if
<
std
::
is_same
_v
<
T
*
,
resumable
*>
>::
type
intrusive_ptr_release
(
T
*
ptr
)
{
intrusive_ptr_release
(
T
*
ptr
)
{
ptr
->
intrusive_ptr_release_impl
();
ptr
->
intrusive_ptr_release_impl
();
}
}
...
...
libcaf_core/caf/save_inspector.hpp
View file @
59a85143
...
@@ -178,7 +178,7 @@ public:
...
@@ -178,7 +178,7 @@ public:
using
save_callback_result
=
decltype
(
save_callback
());
using
save_callback_result
=
decltype
(
save_callback
());
if
(
!
(
f
->
begin_object
(
object_type
,
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
if
(
!
(
f
->
begin_object
(
object_type
,
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
return
false
;
return
false
;
if
constexpr
(
std
::
is_same
<
save_callback_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
save_callback_result
,
bool
>
)
{
if
(
!
save_callback
())
{
if
(
!
save_callback
())
{
f
->
set_error
(
sec
::
save_callback_failed
);
f
->
set_error
(
sec
::
save_callback_failed
);
return
false
;
return
false
;
...
...
libcaf_core/caf/save_inspector_base.hpp
View file @
59a85143
...
@@ -44,7 +44,7 @@ public:
...
@@ -44,7 +44,7 @@ public:
return
false
;
return
false
;
for
(
auto
&&
val
:
xs
)
{
for
(
auto
&&
val
:
xs
)
{
using
found_type
=
std
::
decay_t
<
decltype
(
val
)
>
;
using
found_type
=
std
::
decay_t
<
decltype
(
val
)
>
;
if
constexpr
(
std
::
is_same
<
found_type
,
value_type
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
found_type
,
value_type
>
)
{
if
(
!
detail
::
save
(
dref
(),
val
))
if
(
!
detail
::
save
(
dref
(),
val
))
return
false
;
return
false
;
}
else
{
}
else
{
...
...
libcaf_core/caf/scheduled_actor.hpp
View file @
59a85143
...
@@ -592,7 +592,7 @@ public:
...
@@ -592,7 +592,7 @@ public:
/// and restoring `f` only if it has not been replaced by the user.
/// and restoring `f` only if it has not been replaced by the user.
template
<
class
F
,
class
...
Ts
>
template
<
class
F
,
class
...
Ts
>
auto
call_handler
(
F
&
f
,
Ts
&&
...
xs
)
->
typename
std
::
enable_if
<
auto
call_handler
(
F
&
f
,
Ts
&&
...
xs
)
->
typename
std
::
enable_if
<
!
std
::
is_same
<
decltype
(
f
(
std
::
forward
<
Ts
>
(
xs
)...)),
void
>::
value
,
!
std
::
is_same
_v
<
decltype
(
f
(
std
::
forward
<
Ts
>
(
xs
)...)),
void
>
,
decltype
(
f
(
std
::
forward
<
Ts
>
(
xs
)...))
>::
type
{
decltype
(
f
(
std
::
forward
<
Ts
>
(
xs
)...))
>::
type
{
using
std
::
swap
;
using
std
::
swap
;
F
g
;
F
g
;
...
@@ -605,7 +605,7 @@ public:
...
@@ -605,7 +605,7 @@ public:
template
<
class
F
,
class
...
Ts
>
template
<
class
F
,
class
...
Ts
>
auto
call_handler
(
F
&
f
,
Ts
&&
...
xs
)
->
typename
std
::
enable_if
<
auto
call_handler
(
F
&
f
,
Ts
&&
...
xs
)
->
typename
std
::
enable_if
<
std
::
is_same
<
decltype
(
f
(
std
::
forward
<
Ts
>
(
xs
)...)),
void
>::
value
>::
type
{
std
::
is_same
_v
<
decltype
(
f
(
std
::
forward
<
Ts
>
(
xs
)...)),
void
>
>::
type
{
using
std
::
swap
;
using
std
::
swap
;
F
g
;
F
g
;
swap
(
f
,
g
);
swap
(
f
,
g
);
...
...
libcaf_core/caf/send.hpp
View file @
59a85143
...
@@ -90,7 +90,7 @@ void anon_send(const Dest& dest, Ts&&... xs) {
...
@@ -90,7 +90,7 @@ void anon_send(const Dest& dest, Ts&&... xs) {
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
=
actor
,
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
=
actor
,
class
Rep
=
int
,
class
Period
=
std
::
ratio
<
1
>,
class
...
Ts
>
class
Rep
=
int
,
class
Period
=
std
::
ratio
<
1
>,
class
...
Ts
>
detail
::
enable_if_t
<!
std
::
is_same
<
Dest
,
group
>::
value
>
detail
::
enable_if_t
<!
std
::
is_same
_v
<
Dest
,
group
>
>
delayed_anon_send
(
const
Dest
&
dest
,
std
::
chrono
::
duration
<
Rep
,
Period
>
rtime
,
delayed_anon_send
(
const
Dest
&
dest
,
std
::
chrono
::
duration
<
Rep
,
Period
>
rtime
,
Ts
&&
...
xs
)
{
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
...
libcaf_core/caf/settings.hpp
View file @
59a85143
...
@@ -63,7 +63,7 @@ template <class To = get_or_auto_deduce, class Fallback>
...
@@ -63,7 +63,7 @@ template <class To = get_or_auto_deduce, class Fallback>
auto
get_or
(
const
settings
&
xs
,
std
::
string_view
name
,
Fallback
&&
fallback
)
{
auto
get_or
(
const
settings
&
xs
,
std
::
string_view
name
,
Fallback
&&
fallback
)
{
if
(
auto
ptr
=
get_if
(
&
xs
,
name
))
{
if
(
auto
ptr
=
get_if
(
&
xs
,
name
))
{
return
get_or
<
To
>
(
*
ptr
,
std
::
forward
<
Fallback
>
(
fallback
));
return
get_or
<
To
>
(
*
ptr
,
std
::
forward
<
Fallback
>
(
fallback
));
}
else
if
constexpr
(
std
::
is_same
<
To
,
get_or_auto_deduce
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
To
,
get_or_auto_deduce
>
)
{
using
guide
=
get_or_deduction_guide
<
std
::
decay_t
<
Fallback
>>
;
using
guide
=
get_or_deduction_guide
<
std
::
decay_t
<
Fallback
>>
;
return
guide
::
convert
(
std
::
forward
<
Fallback
>
(
fallback
));
return
guide
::
convert
(
std
::
forward
<
Fallback
>
(
fallback
));
}
else
{
}
else
{
...
...
libcaf_core/caf/string_view.hpp
View file @
59a85143
...
@@ -47,7 +47,7 @@ struct is_string_like {
...
@@ -47,7 +47,7 @@ struct is_string_like {
=
decltype
(
sfinae
(
static_cast
<
typename
std
::
decay
<
T
>::
type
*>
(
nullptr
)));
=
decltype
(
sfinae
(
static_cast
<
typename
std
::
decay
<
T
>::
type
*>
(
nullptr
)));
// Trait result.
// Trait result.
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
static
constexpr
bool
value
=
std
::
is_same
_v
<
bool
,
result_type
>
;
};
};
}
// namespace detail
}
// namespace detail
...
...
libcaf_core/caf/telemetry/counter.hpp
View file @
59a85143
...
@@ -26,9 +26,9 @@ public:
...
@@ -26,9 +26,9 @@ public:
// -- constants --------------------------------------------------------------
// -- constants --------------------------------------------------------------
static
constexpr
metric_type
runtime_type
static
constexpr
metric_type
runtime_type
=
std
::
is_same_v
<
value_type
,
double
>
=
std
::
is_same
<
value_type
,
double
>::
value
?
metric_type
::
dbl_counter
?
metric_type
::
dbl_counter
:
metric_type
::
int_counter
;
:
metric_type
::
int_counter
;
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
/// Increments the counter by 1.
/// Increments the counter by 1.
/// @returns The new value of the counter.
/// @returns The new value of the counter.
template
<
class
T
=
ValueType
>
template
<
class
T
=
ValueType
>
std
::
enable_if_t
<
std
::
is_same
<
T
,
int64_t
>::
value
,
T
>
operator
++
()
noexcept
{
std
::
enable_if_t
<
std
::
is_same
_v
<
T
,
int64_t
>
,
T
>
operator
++
()
noexcept
{
return
++
gauge_
;
return
++
gauge_
;
}
}
...
...
libcaf_core/caf/telemetry/histogram.hpp
View file @
59a85143
...
@@ -37,9 +37,9 @@ public:
...
@@ -37,9 +37,9 @@ public:
// -- constants --------------------------------------------------------------
// -- constants --------------------------------------------------------------
static
constexpr
metric_type
runtime_type
static
constexpr
metric_type
runtime_type
=
std
::
is_same_v
<
value_type
,
double
>
=
std
::
is_same
<
value_type
,
double
>::
value
?
metric_type
::
dbl_histogram
?
metric_type
::
dbl_histogram
:
metric_type
::
int_histogram
;
:
metric_type
::
int_histogram
;
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/caf/telemetry/metric_family_impl.hpp
View file @
59a85143
...
@@ -64,7 +64,7 @@ public:
...
@@ -64,7 +64,7 @@ public:
std
::
vector
<
label
>
cpy
{
labels
.
begin
(),
labels
.
end
()};
std
::
vector
<
label
>
cpy
{
labels
.
begin
(),
labels
.
end
()};
std
::
sort
(
cpy
.
begin
(),
cpy
.
end
());
std
::
sort
(
cpy
.
begin
(),
cpy
.
end
());
std
::
unique_ptr
<
impl_type
>
ptr
;
std
::
unique_ptr
<
impl_type
>
ptr
;
if
constexpr
(
std
::
is_same
<
extra_setting_type
,
unit_t
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
extra_setting_type
,
unit_t
>
)
ptr
.
reset
(
new
impl_type
(
std
::
move
(
cpy
)));
ptr
.
reset
(
new
impl_type
(
std
::
move
(
cpy
)));
else
else
ptr
.
reset
(
new
impl_type
(
std
::
move
(
cpy
),
config_
,
extra_setting_
));
ptr
.
reset
(
new
impl_type
(
std
::
move
(
cpy
),
config_
,
extra_setting_
));
...
...
libcaf_core/caf/typed_behavior.hpp
View file @
59a85143
...
@@ -44,7 +44,7 @@ struct same_output_or_skip_t {
...
@@ -44,7 +44,7 @@ struct same_output_or_skip_t {
using
other
=
typename
RepliesToWith
::
output_types
;
using
other
=
typename
RepliesToWith
::
output_types
;
static
constexpr
bool
value
static
constexpr
bool
value
=
std
::
is_same
<
Output
,
typename
RepliesToWith
::
output_types
>::
value
=
std
::
is_same
<
Output
,
typename
RepliesToWith
::
output_types
>::
value
||
std
::
is_same
<
Output
,
type_list
<
skip_t
>>::
value
;
||
std
::
is_same
_v
<
Output
,
type_list
<
skip_t
>>
;
};
};
template
<
class
SList
>
template
<
class
SList
>
...
...
libcaf_core/caf/typed_response_promise.hpp
View file @
59a85143
...
@@ -82,7 +82,7 @@ public:
...
@@ -82,7 +82,7 @@ public:
/// Satisfies the promise by sending an empty response message.
/// Satisfies the promise by sending an empty response message.
template
<
class
L
=
detail
::
type_list
<
Ts
...>
>
template
<
class
L
=
detail
::
type_list
<
Ts
...>
>
std
::
enable_if_t
<
std
::
is_same
<
L
,
detail
::
type_list
<
void
>>::
value
>
deliver
()
{
std
::
enable_if_t
<
std
::
is_same
_v
<
L
,
detail
::
type_list
<
void
>>
>
deliver
()
{
promise_
.
deliver
();
promise_
.
deliver
();
}
}
...
@@ -96,7 +96,7 @@ public:
...
@@ -96,7 +96,7 @@ public:
/// message.
/// message.
template
<
class
T
>
template
<
class
T
>
std
::
enable_if_t
<
std
::
enable_if_t
<
std
::
is_same
<
detail
::
type_list
<
T
>
,
detail
::
type_list
<
Ts
...
>>::
value
>
std
::
is_same
_v
<
detail
::
type_list
<
T
>
,
detail
::
type_list
<
Ts
...
>>
>
deliver
(
expected
<
T
>
x
)
{
deliver
(
expected
<
T
>
x
)
{
promise_
.
deliver
(
std
::
move
(
x
));
promise_
.
deliver
(
std
::
move
(
x
));
}
}
...
...
libcaf_core/test/actor_lifetime.cpp
View file @
59a85143
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
template
<
class
ExitMsgType
>
template
<
class
ExitMsgType
>
behavior
tester
(
event_based_actor
*
self
,
const
actor
&
aut
)
{
behavior
tester
(
event_based_actor
*
self
,
const
actor
&
aut
)
{
if
(
std
::
is_same
<
ExitMsgType
,
exit_msg
>::
value
)
{
if
(
std
::
is_same
_v
<
ExitMsgType
,
exit_msg
>
)
{
self
->
set_exit_handler
([
self
](
exit_msg
&
msg
)
{
self
->
set_exit_handler
([
self
](
exit_msg
&
msg
)
{
// must be still alive at this point
// must be still alive at this point
CHECK_EQ
(
s_testees
.
load
(),
1
);
CHECK_EQ
(
s_testees
.
load
(),
1
);
...
...
libcaf_core/test/config_value.cpp
View file @
59a85143
...
@@ -636,7 +636,7 @@ SCENARIO("get_or converts or returns a fallback value") {
...
@@ -636,7 +636,7 @@ SCENARIO("get_or converts or returns a fallback value") {
auto
fallback
=
make_span
(
fallback_arr
);
auto
fallback
=
make_span
(
fallback_arr
);
THEN
(
"CAF returns the default value after converting it to vector<int>"
)
{
THEN
(
"CAF returns the default value after converting it to vector<int>"
)
{
auto
result
=
get_or
(
x
,
fallback
);
auto
result
=
get_or
(
x
,
fallback
);
static_assert
(
std
::
is_same
<
decltype
(
result
),
std
::
vector
<
int
>>::
value
);
static_assert
(
std
::
is_same
_v
<
decltype
(
result
),
std
::
vector
<
int
>>
);
CHECK_EQ
(
result
,
std
::
vector
<
int
>
({
10
,
20
,
30
}));
CHECK_EQ
(
result
,
std
::
vector
<
int
>
({
10
,
20
,
30
}));
}
}
}
}
...
@@ -738,7 +738,7 @@ SCENARIO("config values can default-construct all registered types") {
...
@@ -738,7 +738,7 @@ SCENARIO("config values can default-construct all registered types") {
auto parsed = config_value::parse(str); \
auto parsed = config_value::parse(str); \
using init_val_type = decltype(init_val); \
using init_val_type = decltype(init_val); \
if (CHECK(parsed)) { \
if (CHECK(parsed)) { \
if constexpr (!std::is_same
<init_val_type, message>::value)
\
if constexpr (!std::is_same
_v<init_val_type, message>)
\
CHECK_EQ(get_as<init_val_type>(*parsed), init_val); \
CHECK_EQ(get_as<init_val_type>(*parsed), init_val); \
else \
else \
CHECK_EQ(to_string(*parsed), str); \
CHECK_EQ(to_string(*parsed), str); \
...
...
libcaf_core/test/json_reader.cpp
View file @
59a85143
...
@@ -25,7 +25,7 @@ struct fixture {
...
@@ -25,7 +25,7 @@ struct fixture {
auto
res
=
CHECK
(
reader
.
load
(
input
))
// parse JSON
auto
res
=
CHECK
(
reader
.
load
(
input
))
// parse JSON
&&
CHECK
(
reader
.
apply
(
tmp
));
// deserialize object
&&
CHECK
(
reader
.
apply
(
tmp
));
// deserialize object
if
(
res
)
{
if
(
res
)
{
if
constexpr
(
std
::
is_same
<
T
,
message
>::
value
)
if
constexpr
(
std
::
is_same
_v
<
T
,
message
>
)
res
=
CHECK_EQ
(
to_string
(
tmp
),
to_string
(
obj
));
res
=
CHECK_EQ
(
to_string
(
tmp
),
to_string
(
obj
));
else
else
res
=
CHECK_EQ
(
tmp
,
obj
);
res
=
CHECK_EQ
(
tmp
,
obj
);
...
...
libcaf_core/test/metaprogramming.cpp
View file @
59a85143
...
@@ -72,7 +72,7 @@ std::ostream& operator<<(std::ostream& out, token<T>) {
...
@@ -72,7 +72,7 @@ std::ostream& operator<<(std::ostream& out, token<T>) {
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
constexpr
bool
operator
==
(
token
<
T
>
,
token
<
U
>
)
{
constexpr
bool
operator
==
(
token
<
T
>
,
token
<
U
>
)
{
return
std
::
is_same
<
T
,
U
>::
value
;
return
std
::
is_same
_v
<
T
,
U
>
;
}
}
template
<
class
T
>
template
<
class
T
>
...
...
libcaf_core/test/typed_behavior.cpp
View file @
59a85143
...
@@ -21,5 +21,5 @@ CAF_TEST(make_typed_behavior automatically deduces its types) {
...
@@ -21,5 +21,5 @@ CAF_TEST(make_typed_behavior automatically deduces its types) {
auto
bhvr
=
make_typed_behavior
([](
const
std
::
string
&
)
{},
auto
bhvr
=
make_typed_behavior
([](
const
std
::
string
&
)
{},
[](
int32_t
x
)
{
return
x
;
},
[](
int32_t
x
)
{
return
x
;
},
[](
double
x
)
{
return
x
;
});
[](
double
x
)
{
return
x
;
});
static_assert
(
std
::
is_same
<
handle
::
behavior_type
,
decltype
(
bhvr
)
>::
value
);
static_assert
(
std
::
is_same
_v
<
handle
::
behavior_type
,
decltype
(
bhvr
)
>
);
}
}
libcaf_io/caf/io/broker_servant.hpp
View file @
59a85143
...
@@ -84,12 +84,11 @@ protected:
...
@@ -84,12 +84,11 @@ protected:
// tell broker it entered passive mode, this can result in
// tell broker it entered passive mode, this can result in
// producing, why we check the condition again afterwards
// producing, why we check the condition again afterwards
using
passive_t
=
typename
std
::
conditional
<
using
passive_t
=
typename
std
::
conditional
<
std
::
is_same
<
handle_type
,
connection_handle
>::
value
,
std
::
is_same
_v
<
handle_type
,
connection_handle
>
,
connection_passivated_msg
,
connection_passivated_msg
,
typename
std
::
conditional
<
typename
std
::
conditional
<
std
::
is_same_v
<
handle_type
,
accept_handle
>
,
std
::
is_same
<
handle_type
,
accept_handle
>::
value
,
acceptor_passivated_msg
,
acceptor_passivated_msg
,
datagram_servant_passivated_msg
>::
type
>::
type
;
datagram_servant_passivated_msg
>::
type
>::
type
;
mailbox_element
tmp
{
strong_actor_ptr
{},
make_message_id
(),
mailbox_element
tmp
{
strong_actor_ptr
{},
make_message_id
(),
mailbox_element
::
forwarding_stack
{},
mailbox_element
::
forwarding_stack
{},
make_message
(
passive_t
{
hdl
()})};
make_message
(
passive_t
{
hdl
()})};
...
...
libcaf_test/caf/test/dsl.hpp
View file @
59a85143
...
@@ -29,7 +29,7 @@ constexpr bool operator==(const wildcard&, const wildcard&) {
...
@@ -29,7 +29,7 @@ constexpr bool operator==(const wildcard&, const wildcard&) {
template
<
size_t
I
,
class
T
>
template
<
size_t
I
,
class
T
>
bool
cmp_one
(
const
caf
::
message
&
x
,
const
T
&
y
)
{
bool
cmp_one
(
const
caf
::
message
&
x
,
const
T
&
y
)
{
if
(
std
::
is_same
<
T
,
wildcard
>::
value
)
if
(
std
::
is_same
_v
<
T
,
wildcard
>
)
return
true
;
return
true
;
return
x
.
match_element
<
T
>
(
I
)
&&
x
.
get_as
<
T
>
(
I
)
==
y
;
return
x
.
match_element
<
T
>
(
I
)
&&
x
.
get_as
<
T
>
(
I
)
==
y
;
}
}
...
@@ -74,7 +74,7 @@ struct has_outer_type {
...
@@ -74,7 +74,7 @@ struct has_outer_type {
static
auto
sfinae
(...)
->
std
::
false_type
;
static
auto
sfinae
(...)
->
std
::
false_type
;
using
type
=
decltype
(
sfinae
<
T
>
(
nullptr
));
using
type
=
decltype
(
sfinae
<
T
>
(
nullptr
));
static
constexpr
bool
value
=
!
std
::
is_same
<
type
,
std
::
false_type
>::
value
;
static
constexpr
bool
value
=
!
std
::
is_same
_v
<
type
,
std
::
false_type
>
;
};
};
// enables ADL in `with_content`
// enables ADL in `with_content`
...
...
libcaf_test/caf/test/unit_test.hpp
View file @
59a85143
...
@@ -294,9 +294,9 @@ public:
...
@@ -294,9 +294,9 @@ public:
}
}
};
};
using
fwd
=
using
fwd
=
typename
std
::
conditional
<
std
::
is_same
<
char
,
T
>::
value
typename
std
::
conditional
<
std
::
is_same
_v
<
char
,
T
>
||
std
::
is_convertible
<
T
,
std
::
string
>::
value
||
std
::
is_convertible
<
T
,
std
::
string
>::
value
||
std
::
is_same
<
caf
::
term
,
T
>::
value
,
||
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
;
auto
y
=
f
(
x
);
auto
y
=
f
(
x
);
...
...
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