Unverified Commit 59a85143 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #1495

Refactor all calls to is_same::value to is_same_v
parents 61f3fc1c 2994355f
...@@ -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));
......
...@@ -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 = " - ";
......
...@@ -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);
......
...@@ -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))
......
...@@ -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;
......
...@@ -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"); \
......
...@@ -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 {
......
...@@ -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_));
......
...@@ -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));
......
...@@ -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; \
......
...@@ -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));
}); });
......
...@@ -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 {
......
...@@ -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);
......
...@@ -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) {
......
...@@ -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>
......
...@@ -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`.
......
...@@ -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");
} }
}; };
......
...@@ -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
......
...@@ -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 "
......
...@@ -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));
......
...@@ -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));
......
...@@ -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;
......
...@@ -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;
......
...@@ -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");
......
...@@ -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)
......
...@@ -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);
......
...@@ -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();
......
...@@ -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)));
......
...@@ -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();
} }
......
...@@ -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;
......
...@@ -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 {
......
...@@ -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);
......
...@@ -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");
......
...@@ -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 {
......
...@@ -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
......
...@@ -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_;
} }
......
...@@ -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 --------------------
......
...@@ -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_));
......
...@@ -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>
......
...@@ -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));
} }
......
...@@ -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);
......
...@@ -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); \
......
...@@ -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);
......
...@@ -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>
......
...@@ -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)>);
} }
...@@ -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()})};
......
...@@ -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`
......
...@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment