Commit 1bdc08c6 authored by Shariar Azad Riday's avatar Shariar Azad Riday

Refactor all instances of is_base_of<>::value to is_base_of_v<>

parent c37e971a
...@@ -145,7 +145,7 @@ actor_factory make_actor_factory() { ...@@ -145,7 +145,7 @@ actor_factory make_actor_factory() {
static_assert( static_assert(
detail::conjunction<std::is_lvalue_reference<Ts>::value...>::value, detail::conjunction<std::is_lvalue_reference<Ts>::value...>::value,
"all Ts must be lvalue references"); "all Ts must be lvalue references");
static_assert(std::is_base_of<local_actor, T>::value, static_assert(std::is_base_of_v<local_actor, T>,
"T is not derived from local_actor"); "T is not derived from local_actor");
return &dyn_spawn_class<T, Ts...>; return &dyn_spawn_class<T, Ts...>;
} }
......
...@@ -778,7 +778,7 @@ public: ...@@ -778,7 +778,7 @@ public:
private: private:
template <class T> template <class T>
void check_invariants() { void check_invariants() {
static_assert(!std::is_base_of<prohibit_top_level_spawn_marker, T>::value, static_assert(!std::is_base_of_v<prohibit_top_level_spawn_marker, T>,
"This actor type cannot be spawned through an actor system. " "This actor type cannot be spawned through an actor system. "
"Probably you have tried to spawn a broker."); "Probably you have tried to spawn a broker.");
} }
......
...@@ -60,20 +60,19 @@ template <class T> ...@@ -60,20 +60,19 @@ template <class T>
struct default_actor_traits<T, true> { struct default_actor_traits<T, true> {
/// Denotes whether `T` is dynamically typed. /// Denotes whether `T` is dynamically typed.
static constexpr bool is_dynamically_typed static constexpr bool is_dynamically_typed
= std::is_base_of<dynamically_typed_actor_base, T>::value; = std::is_base_of_v<dynamically_typed_actor_base, T>;
/// Denotes whether `T` is statically typed. /// Denotes whether `T` is statically typed.
static constexpr bool is_statically_typed static constexpr bool is_statically_typed
= std::is_base_of<statically_typed_actor_base, T>::value; = std::is_base_of_v<statically_typed_actor_base, T>;
/// Denotes whether `T` is a blocking actor type. /// Denotes whether `T` is a blocking actor type.
static constexpr bool is_blocking static constexpr bool is_blocking = std::is_base_of_v<blocking_actor_base, T>
= std::is_base_of<blocking_actor_base, T>::value || mixin::is_blocking_requester<T>::value;
|| mixin::is_blocking_requester<T>::value;
/// Denotes whether `T` is a non-blocking actor type. /// Denotes whether `T` is a non-blocking actor type.
static constexpr bool is_non_blocking static constexpr bool is_non_blocking
= std::is_base_of<non_blocking_actor_base, T>::value; = std::is_base_of_v<non_blocking_actor_base, T>;
/// Denotes whether `T` is an incomplete actor type that misses one or more /// Denotes whether `T` is an incomplete actor type that misses one or more
/// markers. /// markers.
...@@ -91,6 +90,6 @@ struct default_actor_traits<T, true> { ...@@ -91,6 +90,6 @@ struct default_actor_traits<T, true> {
/// Provides uniform access to properties of actor types. /// Provides uniform access to properties of actor types.
template <class T> template <class T>
struct actor_traits struct actor_traits
: default_actor_traits<T, std::is_base_of<abstract_actor, T>::value> {}; : default_actor_traits<T, std::is_base_of_v<abstract_actor, T>> {};
} // namespace caf } // namespace caf
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
namespace caf::detail { namespace caf::detail {
template <class T, template <class T,
bool IsDyn = std::is_base_of<dynamically_typed_actor_base, T>::value, bool IsDyn = std::is_base_of_v<dynamically_typed_actor_base, T>,
bool IsStat = std::is_base_of<statically_typed_actor_base, T>::value> bool IsStat = std::is_base_of_v<statically_typed_actor_base, T>>
struct implicit_actor_conversions { struct implicit_actor_conversions {
using type = T; using type = T;
}; };
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
template <class... Ts> template <class... Ts>
ptr_type make(F f, Ts&&... xs) { ptr_type make(F f, Ts&&... xs) {
static_assert(std::is_base_of<local_actor, Base>::value, static_assert(std::is_base_of_v<local_actor, Base>,
"Given Base does not extend local_actor"); "Given Base does not extend local_actor");
using trait = typename detail::get_callable_trait<F>::type; using trait = typename detail::get_callable_trait<F>::type;
using arg_types = typename trait::arg_types; using arg_types = typename trait::arg_types;
......
...@@ -37,7 +37,7 @@ struct exec_main_helper<detail::type_list<actor_system&, const T&>> { ...@@ -37,7 +37,7 @@ struct exec_main_helper<detail::type_list<actor_system&, const T&>> {
template <class T> template <class T>
void exec_main_init_meta_objects_single() { void exec_main_init_meta_objects_single() {
if constexpr (std::is_base_of<actor_system::module, T>::value) if constexpr (std::is_base_of_v<actor_system::module, T>)
T::init_global_meta_objects(); T::init_global_meta_objects();
else else
init_global_meta_objects<T>(); init_global_meta_objects<T>();
...@@ -50,7 +50,7 @@ void exec_main_init_meta_objects() { ...@@ -50,7 +50,7 @@ void exec_main_init_meta_objects() {
template <class T> template <class T>
void exec_main_load_module(actor_system_config& cfg) { void exec_main_load_module(actor_system_config& cfg) {
if constexpr (std::is_base_of<actor_system::module, T>::value) if constexpr (std::is_base_of_v<actor_system::module, T>)
cfg.template load<T>(); cfg.template load<T>();
} }
...@@ -67,7 +67,7 @@ int exec_main(F fun, int argc, char** argv) { ...@@ -67,7 +67,7 @@ int exec_main(F fun, int argc, char** argv) {
using arg2 = typename detail::tl_at<arg_types, 1>::type; using arg2 = typename detail::tl_at<arg_types, 1>::type;
using decayed_arg2 = typename std::decay<arg2>::type; using decayed_arg2 = typename std::decay<arg2>::type;
static_assert(std::is_same_v<arg2, unit_t> static_assert(std::is_same_v<arg2, unit_t>
|| (std::is_base_of<actor_system_config, decayed_arg2>::value || (std::is_base_of_v<actor_system_config, decayed_arg2>
&& std::is_same<arg2, const decayed_arg2&>::value), && std::is_same<arg2, const decayed_arg2&>::value),
"second parameter of main function must take a subtype of " "second parameter of main function must take a subtype of "
"actor_system_config as const reference"); "actor_system_config as const reference");
......
...@@ -66,8 +66,8 @@ struct infer_handle_from_fun_impl<typed_behavior<Sigs...>, Impl, false> { ...@@ -66,8 +66,8 @@ struct infer_handle_from_fun_impl<typed_behavior<Sigs...>, Impl, false> {
// statically typed actor with self pointer // statically typed actor with self pointer
template <class... Sigs, class Impl> template <class... Sigs, class Impl>
struct infer_handle_from_fun_impl<typed_behavior<Sigs...>, Impl*, true> { struct infer_handle_from_fun_impl<typed_behavior<Sigs...>, Impl*, true> {
static_assert(std::is_base_of<typed_event_based_actor<Sigs...>, Impl>::value static_assert(std::is_base_of_v<typed_event_based_actor<Sigs...>, Impl>
|| std::is_base_of<io::typed_broker<Sigs...>, Impl>::value, || std::is_base_of_v<io::typed_broker<Sigs...>, Impl>,
"Self pointer does not match the returned behavior type."); "Self pointer does not match the returned behavior type.");
using type = typed_actor<Sigs...>; using type = typed_actor<Sigs...>;
using impl = Impl; using impl = Impl;
...@@ -109,7 +109,7 @@ struct infer_handle_from_behavior<typed_behavior<Sigs...>> { ...@@ -109,7 +109,7 @@ struct infer_handle_from_behavior<typed_behavior<Sigs...>> {
/// Deduces `actor` for dynamically typed actors, otherwise `typed_actor<...>` /// Deduces `actor` for dynamically typed actors, otherwise `typed_actor<...>`
/// is deduced. /// is deduced.
template <class T, bool = std::is_base_of<abstract_actor, T>::value> template <class T, bool = std::is_base_of_v<abstract_actor, T>>
struct infer_handle_from_class { struct infer_handle_from_class {
using type = using type =
typename infer_handle_from_behavior<typename T::behavior_type>::type; typename infer_handle_from_behavior<typename T::behavior_type>::type;
......
...@@ -230,8 +230,7 @@ private: ...@@ -230,8 +230,7 @@ private:
} }
template <class T = Base> template <class T = Base>
detail::enable_if_t<std::is_base_of<abstract_actor, T>::value, Subtype*> detail::enable_if_t<std::is_base_of_v<abstract_actor, T>, Subtype*> dptr() {
dptr() {
return static_cast<Subtype*>(this); return static_cast<Subtype*>(this);
} }
......
...@@ -102,7 +102,7 @@ private: ...@@ -102,7 +102,7 @@ private:
/// @ref deserializer directly or that provides a compatible API. /// @ref deserializer directly or that provides a compatible API.
template <class Self, class Adapter, class Reader> template <class Self, class Adapter, class Reader>
auto make_mtl(Self* self, Adapter adapter, Reader* reader) { auto make_mtl(Self* self, Adapter adapter, Reader* reader) {
if constexpr (std::is_base_of<non_blocking_actor_base, Self>::value) { if constexpr (std::is_base_of_v<non_blocking_actor_base, Self>) {
return event_based_mtl{self, adapter, reader}; return event_based_mtl{self, adapter, reader};
} else { } else {
static_assert(detail::always_false_v<Self>, static_assert(detail::always_false_v<Self>,
......
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
// Enable `handle_type{self}` for typed actor views. // Enable `handle_type{self}` for typed actor views.
template <class T, class = std::enable_if_t< template <class T, class = std::enable_if_t<
std::is_base_of<typed_actor_view_base, T>::value>> std::is_base_of_v<typed_actor_view_base, T>>>
explicit typed_actor(T ptr) : ptr_(ptr.ctrl()) { explicit typed_actor(T ptr) : ptr_(ptr.ctrl()) {
static_assert( static_assert(
detail::tl_subset_of<signatures, typename T::signatures>::value, detail::tl_subset_of<signatures, typename T::signatures>::value,
......
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