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
2994355f
Commit
2994355f
authored
Jul 18, 2023
by
Shariar Azad Riday
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor all calls to is_same::value to is_same_v
parent
f42cf82d
Changes
48
Show 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 @
2994355f
...
...
@@ -173,7 +173,7 @@ struct variant_inspector_traits<shape_ptr> {
// Assigns a value to x.
template
<
class
U
>
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
();
else
x
=
std
::
make_shared
<
U
>
(
std
::
move
(
value
));
...
...
examples/remoting/distributed_calculator.cpp
View file @
2994355f
...
...
@@ -155,7 +155,7 @@ behavior running(stateful_actor<state>* self, const actor& calculator) {
.
then
(
[
=
](
int
result
)
{
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
=
" + "
;
else
op_str
=
" - "
;
...
...
libcaf_core/caf/actor_system.hpp
View file @
2994355f
...
...
@@ -465,7 +465,7 @@ public:
template
<
class
T
,
spawn_options
Os
,
class
Iter
,
class
...
Ts
>
infer_handle_from_class_t
<
T
>
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"
);
check_invariants
<
T
>
();
auto
irange
=
make_input_range
(
first
,
last
);
...
...
libcaf_core/caf/config_value.hpp
View file @
2994355f
...
...
@@ -98,7 +98,7 @@ public:
config_value
(
const
config_value
&
other
)
=
default
;
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
)
{
set
(
std
::
forward
<
T
>
(
x
));
}
...
...
@@ -108,7 +108,7 @@ public:
config_value
&
operator
=
(
const
config_value
&
other
)
=
default
;
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
)
{
set
(
std
::
forward
<
T
>
(
x
));
return
*
this
;
...
...
@@ -361,9 +361,9 @@ get_as(const config_value& x, inspector_access_type::builtin_inspect token) {
template
<
class
T
>
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
);
}
else
if
constexpr
(
std
::
is_same
<
T
,
bool
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
bool
>
)
{
return
x
.
to_boolean
();
}
else
if
constexpr
(
std
::
is_integral
<
T
>::
value
)
{
if
(
auto
result
=
x
.
to_integer
())
{
...
...
@@ -488,13 +488,13 @@ expected<T> get_as(const config_value& x, inspector_access_type::list) {
/// @relates config_value
template
<
class
T
>
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
();
}
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
();
}
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
();
}
else
if
constexpr
(
std
::
is_same
<
T
,
uri
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
uri
>
)
{
return
value
.
to_uri
();
}
else
{
auto
token
=
inspect_access_type
<
config_value_reader
,
T
>
();
...
...
@@ -550,7 +550,7 @@ struct get_or_auto_deduce {};
/// @relates config_value
template
<
class
To
=
get_or_auto_deduce
,
class
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
value_type
=
typename
guide
::
value_type
;
if
(
auto
val
=
get_as
<
value_type
>
(
x
))
...
...
libcaf_core/caf/config_value_reader.cpp
View file @
2994355f
...
...
@@ -440,7 +440,7 @@ bool pull(config_value_reader& reader, T& x) {
}
}
else
if
(
holds_alternative
<
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
;
reader
.
pop
();
return
true
;
...
...
libcaf_core/caf/config_value_writer.cpp
View file @
2994355f
...
...
@@ -20,7 +20,7 @@
#define SCOPE(top_type) \
CHECK_NOT_EMPTY(); \
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, \
"attempted to add list items before calling " \
"begin_sequence or begin_tuple"); \
...
...
libcaf_core/caf/detail/behavior_impl.hpp
View file @
2994355f
...
...
@@ -119,7 +119,7 @@ public:
if
(
arg_types
==
msg
.
types
())
{
typename
trait
::
message_view_type
xs
{
msg
};
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
);
f
(
unit
);
}
else
{
...
...
libcaf_core/caf/detail/config_consumer.cpp
View file @
2994355f
...
...
@@ -106,7 +106,7 @@ void config_consumer::destroy() {
void
config_consumer
::
end_map
()
{
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
}
else
{
ptr
->
value
(
std
::
move
(
*
cfg_
));
...
...
libcaf_core/caf/detail/mtl_util.hpp
View file @
2994355f
...
...
@@ -42,7 +42,7 @@ struct mtl_util<result<Rs...>(Ts...)> {
OnError
&
on_error
,
Ts
...
xs
)
{
f
.
revert
();
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
)...)
.
then
([
f
{
std
::
move
(
on_result
)}]()
mutable
{
f
();
},
std
::
move
(
on_error
));
...
...
libcaf_core/caf/detail/parser/fsm.hpp
View file @
2994355f
...
...
@@ -12,7 +12,7 @@
#define CAF_FSM_EVAL_ACTION(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) { \
ps.code = code; \
return; \
...
...
libcaf_core/caf/detail/parser/read_string.hpp
View file @
2994355f
...
...
@@ -24,11 +24,10 @@ template <class State, class Consumer>
void
read_string
(
State
&
ps
,
Consumer
&&
consumer
)
{
// Allow Consumer to be a string&, in which case we simply store the result
// directly in the reference.
using
res_type
=
std
::
conditional_t
<
std
::
is_same
<
Consumer
,
std
::
string
&>::
value
,
using
res_type
=
std
::
conditional_t
<
std
::
is_same_v
<
Consumer
,
std
::
string
&>
,
std
::
string
&
,
std
::
string
>
;
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
();
return
c
;
}
else
{
...
...
@@ -37,7 +36,7 @@ void read_string(State& ps, Consumer&& consumer) {
};
res_type
res
=
init_res
(
consumer
);
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
)
consumer
.
value
(
std
::
move
(
res
));
});
...
...
libcaf_core/caf/detail/profiled_send.hpp
View file @
2994355f
...
...
@@ -38,7 +38,7 @@ disposable profiled_send(Self* self, SelfHandle&& src, const Handle& dst,
actor_clock
&
clock
,
actor_clock
::
time_point
timeout
,
[[
maybe_unused
]]
message_id
msg_id
,
Ts
&&
...
xs
)
{
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
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
}
else
{
...
...
libcaf_core/caf/detail/set_thread_name.cpp
View file @
2994355f
...
...
@@ -26,7 +26,7 @@ void set_thread_name(const char* name) {
#ifdef CAF_WINDOWS
// nop
#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"
);
# if defined(CAF_MACOS)
pthread_setname_np
(
name
);
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
2994355f
...
...
@@ -172,9 +172,9 @@ public:
sep
();
result_
+=
"null"
;
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
)});
}
else
if
constexpr
(
std
::
is_same
<
T
,
void
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
T
,
void
>
)
{
sep
();
result_
+=
"*<"
;
auto
addr
=
reinterpret_cast
<
intptr_t
>
(
x
);
...
...
@@ -218,7 +218,7 @@ public:
template
<
class
T
>
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"
;
}
else
if
constexpr
(
std
::
is_constructible
<
std
::
string_view
,
T
>::
value
)
{
if
constexpr
(
std
::
is_pointer
<
T
>::
value
)
{
...
...
libcaf_core/caf/detail/type_list.hpp
View file @
2994355f
...
...
@@ -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`.
template
<
class
List
,
class
T
>
struct
tl_count_type
{
static
constexpr
size_t
value
=
(
std
::
is_same
<
tl_head_t
<
List
>
,
T
>::
value
?
1
:
0
)
static
constexpr
size_t
value
=
(
std
::
is_same_v
<
tl_head_t
<
List
>
,
T
>
?
1
:
0
)
+
tl_count_type
<
tl_tail_t
<
List
>
,
T
>::
value
;
};
...
...
@@ -676,8 +675,8 @@ struct tl_filter_type;
template
<
class
Type
,
class
...
T
>
struct
tl_filter_type
<
type_list
<
T
...
>
,
Type
>
{
using
type
=
typename
tl_filter_impl
<
type_list
<
T
...
>
,
!
std
::
is_same
<
T
,
Type
>::
value
...
>::
type
;
using
type
=
typename
tl_filter_impl
<
type_list
<
T
...
>
,
!
std
::
is_same_v
<
T
,
Type
>
...
>::
type
;
};
template
<
class
List
,
class
T
>
...
...
@@ -690,9 +689,8 @@ struct tl_filter_not_type;
template
<
class
Type
,
class
...
T
>
struct
tl_filter_not_type
<
type_list
<
T
...
>
,
Type
>
{
using
type
=
typename
tl_filter_impl
<
type_list
<
T
...
>
,
(
!
std
::
is_same
<
T
,
Type
>::
value
)...
>::
type
;
using
type
=
typename
tl_filter_impl
<
type_list
<
T
...
>
,
(
!
std
::
is_same_v
<
T
,
Type
>
)
...
>::
type
;
};
template
<
class
List
,
class
T
>
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
2994355f
...
...
@@ -172,7 +172,7 @@ class is_comparable {
&&
std
::
is_arithmetic
<
T2
>::
value
>
{}));
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.
...
...
@@ -194,7 +194,7 @@ class is_forward_iterator {
using
result_type
=
decltype
(
sfinae
(
std
::
declval
<
T
&>
(),
std
::
declval
<
T
&>
()));
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
...
...
@@ -217,7 +217,7 @@ class is_iterable {
public:
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
>
...
...
@@ -363,7 +363,7 @@ struct is_callable {
using
result_type
=
decltype
(
_fun
(
static_cast
<
decay_t
<
T
>*>
(
nullptr
)));
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...`.
...
...
@@ -552,8 +552,8 @@ constexpr bool is_expected_v = is_expected<T>::value;
template
<
class
T
,
class
U
,
bool
Enable
=
std
::
is_integral
<
T
>
::
value
&&
std
::
is_integral
<
U
>::
value
&&
!
std
::
is_same
<
T
,
bool
>::
value
&&
!
std
::
is_same
<
U
,
bool
>::
value
>
&&
!
std
::
is_same
_v
<
T
,
bool
>
&&
!
std
::
is_same
_v
<
U
,
bool
>
>
// clang-format on
struct
is_equal_int_type
{
static
constexpr
bool
value
=
sizeof
(
T
)
==
sizeof
(
U
)
...
...
@@ -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
/// `uint8_t != unsigned char on some compilers.
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
{};
/// Utility for fallbacks calling `static_assert`.
...
...
@@ -878,8 +878,7 @@ private:
using
result_type
=
decltype
(
sfinae
(
std
::
declval
<
Inspector
&>
()));
public:
static
constexpr
bool
value
=
std
::
is_same
<
result_type
,
execution_unit
*>::
value
;
static
constexpr
bool
value
=
std
::
is_same_v
<
result_type
,
execution_unit
*>
;
};
/// Checks whether `T` provides an `inspect` overload for `Inspector`.
...
...
libcaf_core/caf/detail/typed_actor_util.hpp
View file @
2994355f
...
...
@@ -39,9 +39,9 @@ struct type_checker {
static
void
check
()
{
using
arg_types
=
typename
tl_map
<
typename
get_callable_trait
<
F
>::
arg_types
,
std
::
decay
>::
type
;
static_assert
(
std
::
is_same
<
Output
,
arg_types
>::
value
||
(
std
::
is_same
<
Output
,
type_list
<
void
>>::
value
&&
std
::
is_same
<
arg_types
,
type_list
<>>::
value
),
static_assert
(
std
::
is_same
_v
<
Output
,
arg_types
>
||
(
std
::
is_same
_v
<
Output
,
type_list
<
void
>>
&&
std
::
is_same
_v
<
arg_types
,
type_list
<>>
),
"wrong functor signature"
);
}
};
...
...
libcaf_core/caf/error_code.hpp
View file @
2994355f
...
...
@@ -23,7 +23,7 @@ public:
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
))
{
// nop
...
...
libcaf_core/caf/exec_main.hpp
View file @
2994355f
...
...
@@ -66,7 +66,7 @@ int exec_main(F fun, int argc, char** argv) {
"main function must take actor_system& as first parameter"
);
using
arg2
=
typename
detail
::
tl_at
<
arg_types
,
1
>::
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_same
<
arg2
,
const
decayed_arg2
&>::
value
),
"second parameter of main function must take a subtype of "
...
...
libcaf_core/caf/inspector_access.hpp
View file @
2994355f
...
...
@@ -53,9 +53,9 @@ constexpr bool assertion_failed_v = false;
template
<
class
Inspector
,
class
Set
,
class
ValueType
>
auto
bind_setter
(
Inspector
&
f
,
Set
&
set
,
ValueType
&
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
));
};
}
else
if
constexpr
(
std
::
is_same
<
set_result_type
,
error
>::
value
)
{
}
else
if
constexpr
(
std
::
is_same
_v
<
set_result_type
,
error
>
)
{
return
[
&
]
{
if
(
auto
err
=
set
(
std
::
move
(
tmp
));
!
err
)
{
return
true
;
...
...
@@ -65,7 +65,7 @@ auto bind_setter(Inspector& f, Set& set, ValueType& tmp) {
}
};
}
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"
);
return
[
&
]
{
set
(
std
::
move
(
tmp
));
...
...
libcaf_core/caf/load_inspector.hpp
View file @
2994355f
...
...
@@ -282,7 +282,7 @@ public:
using
load_callback_result
=
decltype
(
load_callback
());
if
(
!
(
f
->
begin_object
(
object_type
,
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
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
())
{
f
->
set_error
(
sec
::
load_callback_failed
);
return
false
;
...
...
@@ -351,11 +351,11 @@ public:
static
auto
field
(
std
::
string_view
name
,
Get
get
,
Set
set
)
{
using
field_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
setter_result
=
decltype
(
set
(
std
::
declval
<
field_type
&&>
()));
if
constexpr
(
std
::
is_same
<
setter_result
,
error
>::
value
||
std
::
is_same
<
setter_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
setter_result
,
error
>
||
std
::
is_same
_v
<
setter_result
,
bool
>
)
{
return
virt_field_t
<
field_type
,
Set
>
{
name
,
std
::
move
(
set
)};
}
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"
);
auto
set_fun
=
[
f
{
std
::
move
(
set
)}](
field_type
&&
val
)
{
f
(
std
::
move
(
val
));
...
...
@@ -371,13 +371,13 @@ public:
field
(
std
::
string_view
name
,
IsPresent
&&
,
Get
&&
get
,
Reset
reset
,
Set
set
)
{
using
field_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
using
setter_result
=
decltype
(
set
(
std
::
declval
<
field_type
&&>
()));
if
constexpr
(
std
::
is_same
<
setter_result
,
error
>::
value
||
std
::
is_same
<
setter_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
_v
<
setter_result
,
error
>
||
std
::
is_same
_v
<
setter_result
,
bool
>
)
{
return
optional_virt_field_t
<
field_type
,
Reset
,
Set
>
{
name
,
std
::
move
(
reset
),
std
::
move
(
set
)};
}
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"
);
auto
set_fun
=
[
f
{
std
::
move
(
set
)}](
field_type
&&
val
)
{
f
(
std
::
move
(
val
));
...
...
libcaf_core/caf/load_inspector_base.hpp
View file @
2994355f
...
...
@@ -115,7 +115,7 @@ public:
using
value_type
=
std
::
decay_t
<
decltype
(
get
())
>
;
auto
tmp
=
value_type
{};
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
(
set
(
std
::
move
(
tmp
)))
{
return
true
;
...
...
@@ -126,7 +126,7 @@ public:
}
else
{
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
))
{
set
(
std
::
move
(
tmp
));
return
true
;
...
...
libcaf_core/caf/message.hpp
View file @
2994355f
...
...
@@ -181,7 +181,7 @@ public:
private:
template
<
size_t
Pos
,
class
T
>
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
;
else
return
match_element
<
T
>
(
Pos
)
&&
get_as
<
T
>
(
Pos
)
==
value
;
...
...
libcaf_core/caf/mixin/sender.hpp
View file @
2994355f
...
...
@@ -67,7 +67,7 @@ public:
/// Sends `{xs...}` as an asynchronous message to `dest` with priority `mp`.
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
,
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
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
((
detail
::
sendable
<
Ts
>
&&
...),
...
...
@@ -99,7 +99,7 @@ public:
/// passed already).
template
<
message_priority
P
=
message_priority
::
normal
,
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
>
scheduled_send
(
const
Dest
&
dest
,
actor_clock
::
time_point
timeout
,
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
...
@@ -139,7 +139,7 @@ public:
/// Sends a message after a relative timeout.
template
<
message_priority
P
=
message_priority
::
normal
,
class
Rep
=
int
,
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
,
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
...
libcaf_core/caf/mtl.hpp
View file @
2994355f
...
...
@@ -80,7 +80,7 @@ public:
bool
try_request
(
const
typed_actor
<
Fs
...
>&
dst
,
Timeout
timeout
,
OnResult
on_result
,
OnError
on_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
);
return
(
detail
::
mtl_util
<
Fs
>::
request
(
self_
,
dst_hdl
,
timeout
,
adapter_
,
*
reader_
,
on_result
,
on_error
)
...
...
libcaf_core/caf/node_id.cpp
View file @
2994355f
...
...
@@ -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
)
{
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
());
else
x
.
print
(
str
);
...
...
libcaf_core/caf/response_handle.hpp
View file @
2994355f
...
...
@@ -65,7 +65,7 @@ public:
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide an operator() that takes a caf::error"
);
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 "
"type other than void"
);
policy_type
::
template
type_checker
<
F
>
::
check
();
...
...
@@ -90,7 +90,7 @@ public:
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide an operator() that takes a caf::error"
);
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 "
"type other than void"
);
policy_type
::
template
type_checker
<
F
>
::
check
();
...
...
@@ -129,7 +129,7 @@ public:
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide an operator() that takes a caf::error"
);
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 "
"type other than void"
);
policy_type
::
template
type_checker
<
F
>
::
check
();
...
...
libcaf_core/caf/response_promise.hpp
View file @
2994355f
...
...
@@ -117,8 +117,7 @@ public:
void
deliver
(
expected
<
T
>
x
)
{
if
(
pending
())
{
if
(
x
)
{
if
constexpr
(
std
::
is_same
<
T
,
void
>::
value
||
std
::
is_same
<
T
,
unit_t
>::
value
)
if
constexpr
(
std
::
is_same_v
<
T
,
void
>
||
std
::
is_same_v
<
T
,
unit_t
>
)
state_
->
deliver_impl
(
make_message
());
else
state_
->
deliver_impl
(
make_message
(
std
::
move
(
*
x
)));
...
...
libcaf_core/caf/resumable.hpp
View file @
2994355f
...
...
@@ -61,14 +61,14 @@ public:
// enables intrusive_ptr<resumable> without introducing ambiguity
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
)
{
ptr
->
intrusive_ptr_add_ref_impl
();
}
// enables intrusive_ptr<resumable> without introducing ambiguity
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
)
{
ptr
->
intrusive_ptr_release_impl
();
}
...
...
libcaf_core/caf/save_inspector.hpp
View file @
2994355f
...
...
@@ -178,7 +178,7 @@ public:
using
save_callback_result
=
decltype
(
save_callback
());
if
(
!
(
f
->
begin_object
(
object_type
,
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
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
())
{
f
->
set_error
(
sec
::
save_callback_failed
);
return
false
;
...
...
libcaf_core/caf/save_inspector_base.hpp
View file @
2994355f
...
...
@@ -44,7 +44,7 @@ public:
return
false
;
for
(
auto
&&
val
:
xs
)
{
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
))
return
false
;
}
else
{
...
...
libcaf_core/caf/scheduled_actor.hpp
View file @
2994355f
...
...
@@ -592,7 +592,7 @@ public:
/// and restoring `f` only if it has not been replaced by the user.
template
<
class
F
,
class
...
Ts
>
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
{
using
std
::
swap
;
F
g
;
...
...
@@ -605,7 +605,7 @@ public:
template
<
class
F
,
class
...
Ts
>
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
;
F
g
;
swap
(
f
,
g
);
...
...
libcaf_core/caf/send.hpp
View file @
2994355f
...
...
@@ -90,7 +90,7 @@ void anon_send(const Dest& dest, Ts&&... xs) {
template
<
message_priority
P
=
message_priority
::
normal
,
class
Dest
=
actor
,
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
,
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
...
libcaf_core/caf/settings.hpp
View file @
2994355f
...
...
@@ -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
)
{
if
(
auto
ptr
=
get_if
(
&
xs
,
name
))
{
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
>>
;
return
guide
::
convert
(
std
::
forward
<
Fallback
>
(
fallback
));
}
else
{
...
...
libcaf_core/caf/string_view.hpp
View file @
2994355f
...
...
@@ -47,7 +47,7 @@ struct is_string_like {
=
decltype
(
sfinae
(
static_cast
<
typename
std
::
decay
<
T
>::
type
*>
(
nullptr
)));
// 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
...
...
libcaf_core/caf/telemetry/counter.hpp
View file @
2994355f
...
...
@@ -26,8 +26,8 @@ public:
// -- constants --------------------------------------------------------------
static
constexpr
metric_type
runtime_type
=
std
::
is_same
<
value_type
,
double
>::
value
?
metric_type
::
dbl_counter
static
constexpr
metric_type
runtime_type
=
std
::
is_same_v
<
value_type
,
double
>
?
metric_type
::
dbl_counter
:
metric_type
::
int_counter
;
// -- constructors, destructors, and assignment operators --------------------
...
...
@@ -59,7 +59,7 @@ public:
/// Increments the counter by 1.
/// @returns The new value of the counter.
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_
;
}
...
...
libcaf_core/caf/telemetry/histogram.hpp
View file @
2994355f
...
...
@@ -37,8 +37,8 @@ public:
// -- constants --------------------------------------------------------------
static
constexpr
metric_type
runtime_type
=
std
::
is_same
<
value_type
,
double
>::
value
?
metric_type
::
dbl_histogram
static
constexpr
metric_type
runtime_type
=
std
::
is_same_v
<
value_type
,
double
>
?
metric_type
::
dbl_histogram
:
metric_type
::
int_histogram
;
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/caf/telemetry/metric_family_impl.hpp
View file @
2994355f
...
...
@@ -64,7 +64,7 @@ public:
std
::
vector
<
label
>
cpy
{
labels
.
begin
(),
labels
.
end
()};
std
::
sort
(
cpy
.
begin
(),
cpy
.
end
());
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
)));
else
ptr
.
reset
(
new
impl_type
(
std
::
move
(
cpy
),
config_
,
extra_setting_
));
...
...
libcaf_core/caf/typed_behavior.hpp
View file @
2994355f
...
...
@@ -44,7 +44,7 @@ struct same_output_or_skip_t {
using
other
=
typename
RepliesToWith
::
output_types
;
static
constexpr
bool
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
>
...
...
libcaf_core/caf/typed_response_promise.hpp
View file @
2994355f
...
...
@@ -82,7 +82,7 @@ public:
/// Satisfies the promise by sending an empty response message.
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
();
}
...
...
@@ -96,7 +96,7 @@ public:
/// message.
template
<
class
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
)
{
promise_
.
deliver
(
std
::
move
(
x
));
}
...
...
libcaf_core/test/actor_lifetime.cpp
View file @
2994355f
...
...
@@ -52,7 +52,7 @@ public:
template
<
class
ExitMsgType
>
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
)
{
// must be still alive at this point
CHECK_EQ
(
s_testees
.
load
(),
1
);
...
...
libcaf_core/test/config_value.cpp
View file @
2994355f
...
...
@@ -636,7 +636,7 @@ SCENARIO("get_or converts or returns a fallback value") {
auto
fallback
=
make_span
(
fallback_arr
);
THEN
(
"CAF returns the default value after converting it to vector<int>"
)
{
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
}));
}
}
...
...
@@ -738,7 +738,7 @@ SCENARIO("config values can default-construct all registered types") {
auto parsed = config_value::parse(str); \
using init_val_type = decltype(init_val); \
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); \
else \
CHECK_EQ(to_string(*parsed), str); \
...
...
libcaf_core/test/json_reader.cpp
View file @
2994355f
...
...
@@ -25,7 +25,7 @@ struct fixture {
auto
res
=
CHECK
(
reader
.
load
(
input
))
// parse JSON
&&
CHECK
(
reader
.
apply
(
tmp
));
// deserialize object
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
));
else
res
=
CHECK_EQ
(
tmp
,
obj
);
...
...
libcaf_core/test/metaprogramming.cpp
View file @
2994355f
...
...
@@ -72,7 +72,7 @@ std::ostream& operator<<(std::ostream& out, token<T>) {
template
<
class
T
,
class
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
>
...
...
libcaf_core/test/typed_behavior.cpp
View file @
2994355f
...
...
@@ -21,5 +21,5 @@ CAF_TEST(make_typed_behavior automatically deduces its types) {
auto
bhvr
=
make_typed_behavior
([](
const
std
::
string
&
)
{},
[](
int32_t
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 @
2994355f
...
...
@@ -84,10 +84,9 @@ protected:
// tell broker it entered passive mode, this can result in
// producing, why we check the condition again afterwards
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
,
typename
std
::
conditional
<
std
::
is_same
<
handle_type
,
accept_handle
>::
value
,
typename
std
::
conditional
<
std
::
is_same_v
<
handle_type
,
accept_handle
>
,
acceptor_passivated_msg
,
datagram_servant_passivated_msg
>::
type
>::
type
;
mailbox_element
tmp
{
strong_actor_ptr
{},
make_message_id
(),
...
...
libcaf_test/caf/test/dsl.hpp
View file @
2994355f
...
...
@@ -29,7 +29,7 @@ constexpr bool operator==(const wildcard&, const wildcard&) {
template
<
size_t
I
,
class
T
>
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
x
.
match_element
<
T
>
(
I
)
&&
x
.
get_as
<
T
>
(
I
)
==
y
;
}
...
...
@@ -74,7 +74,7 @@ struct has_outer_type {
static
auto
sfinae
(...)
->
std
::
false_type
;
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`
...
...
libcaf_test/caf/test/unit_test.hpp
View file @
2994355f
...
...
@@ -294,9 +294,9 @@ public:
}
};
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_same
<
caf
::
term
,
T
>::
value
,
||
std
::
is_same
_v
<
caf
::
term
,
T
>
,
simple_fwd_t
,
deep_to_string_t
>::
type
;
fwd
f
;
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