Skip to content

Commit

Permalink
Merge pull request #1757
Browse files Browse the repository at this point in the history
Lift type_list from detail to general namespace
  • Loading branch information
Neverlord committed Feb 15, 2024
2 parents 96a76c4 + 1b69d9d commit 80ae89b
Show file tree
Hide file tree
Showing 48 changed files with 127 additions and 127 deletions.
9 changes: 4 additions & 5 deletions libcaf_core/caf/actor_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ template <class F, class T, class Bhvr, spawn_mode Mode, class R, class Sig>
class fun_decorator;

template <class F, class T, class Bhvr, class R, class... Ts>
class fun_decorator<F, T, Bhvr, spawn_mode::function, R,
detail::type_list<Ts...>> {
class fun_decorator<F, T, Bhvr, spawn_mode::function, R, type_list<Ts...>> {
public:
fun_decorator(F f, T*, behavior* bhvr) : f_(std::move(f)), bhvr_(bhvr) {
// nop
Expand All @@ -51,7 +50,7 @@ class fun_decorator<F, T, Bhvr, spawn_mode::function, R,

template <class F, class T, class Bhvr, class R, class... Ts>
class fun_decorator<F, T, Bhvr, spawn_mode::function_with_selfptr, R,
detail::type_list<T*, Ts...>> {
type_list<T*, Ts...>> {
public:
fun_decorator(F f, T* ptr, behavior* bhvr)
: f_(std::move(f)), ptr_(ptr), bhvr_(bhvr) {
Expand All @@ -77,15 +76,15 @@ template <spawn_mode Mode, class Args>
struct message_verifier;

template <class... Ts>
struct message_verifier<spawn_mode::function, detail::type_list<Ts...>> {
struct message_verifier<spawn_mode::function, type_list<Ts...>> {
bool operator()(message& msg) {
return msg.types() == make_type_id_list<Ts...>();
}
};

template <class Self, class... Ts>
struct message_verifier<spawn_mode::function_with_selfptr,
detail::type_list<Self*, Ts...>> {
type_list<Self*, Ts...>> {
bool operator()(message& msg) {
return msg.types() == make_type_id_list<Ts...>();
}
Expand Down
8 changes: 4 additions & 4 deletions libcaf_core/caf/actor_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,28 +253,28 @@ class CAF_CORE_EXPORT actor_system {
using mpi = std::set<std::string>;

template <class T, class E = std::enable_if_t<!is_typed_actor_v<T>>>
mpi message_types(detail::type_list<T>) const {
mpi message_types(type_list<T>) const {
return mpi{};
}

template <class... Ts>
mpi message_types(detail::type_list<typed_actor<Ts...>>) const {
mpi message_types(type_list<typed_actor<Ts...>>) const {
static_assert(sizeof...(Ts) > 0, "empty typed actor handle given");
mpi result{detail::get_rtti_from_mpi<Ts>()...};
return result;
}

template <class T, class E = std::enable_if_t<!detail::is_type_list_v<T>>>
mpi message_types(const T&) const {
detail::type_list<T> token;
type_list<T> token;
return message_types(token);
}

/// Returns a string representation of the messaging
/// interface using portable names;
template <class T>
mpi message_types() const {
detail::type_list<T> token;
type_list<T> token;
return message_types(token);
}

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/actor_system_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CAF_CORE_EXPORT actor_system_config {
actor_system_config& load() {
T::add_module_options(*this);
module_factories.push_back([](actor_system& sys) -> actor_system::module* {
return T::make(sys, detail::type_list<Ts...>{});
return T::make(sys, type_list<Ts...>{});
});
return *this;
}
Expand Down
1 change: 0 additions & 1 deletion libcaf_core/caf/behavior.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "caf/detail/behavior_impl.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/none.hpp"
#include "caf/timeout_definition.hpp"
Expand Down
4 changes: 2 additions & 2 deletions libcaf_core/caf/config_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class CAF_CORE_EXPORT config_value {

using dictionary = caf::dictionary<config_value>;

using types = detail::type_list<none_t, integer, boolean, real, timespan, uri,
string, list, dictionary>;
using types = type_list<none_t, integer, boolean, real, timespan, uri, string,
list, dictionary>;

using variant_type = detail::tl_apply_t<types, std::variant>;

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/const_typed_message_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class const_typed_message_view {
template <size_t Index, class... Ts>
const auto& get(const_typed_message_view<Ts...> xs) {
static_assert(Index < sizeof...(Ts));
using type = caf::detail::tl_at_t<caf::detail::type_list<Ts...>, Index>;
using type = caf::detail::tl_at_t<caf::type_list<Ts...>, Index>;
return *reinterpret_cast<const type*>(xs->storage()
+ detail::offset_at<Index, Ts...>);
}
Expand Down
1 change: 0 additions & 1 deletion libcaf_core/caf/detail/functor_attachable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include "caf/attachable.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"

namespace caf::detail {
Expand Down
4 changes: 3 additions & 1 deletion libcaf_core/caf/detail/int_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

#pragma once

#include "caf/detail/type_list.hpp"
#include "caf/type_list.hpp"

#include <cstddef>

namespace caf::detail {

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/detail/mtl_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#pragma once

#include "caf/actor.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/fwd.hpp"
#include "caf/type_list.hpp"

#include <type_traits>

Expand Down
4 changes: 2 additions & 2 deletions libcaf_core/caf/detail/send_type_check.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#pragma once

#include "caf/detail/implicit_conversions.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/response_type.hpp"
#include "caf/type_list.hpp"

#include <type_traits>

Expand All @@ -25,7 +25,7 @@ constexpr void send_type_check() {
static_assert((detail::sendable<Ts> && ...),
"at least one type has no ID, "
"did you forgot to announce it via CAF_ADD_TYPE_ID?");
using inputs = detail::type_list<detail::strip_and_convert_t<Ts>...>;
using inputs = type_list<detail::strip_and_convert_t<Ts>...>;
using response_opt = response_type_unbox<signatures_of_t<Handle>, inputs>;
static_assert(response_opt::valid, "receiver does not accept given message");
if constexpr (!std::is_same_v<SenderInterface, none_t>) {
Expand Down
9 changes: 1 addition & 8 deletions libcaf_core/caf/detail/type_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "caf/fwd.hpp"
#include "caf/none.hpp"
#include "caf/type_list.hpp"
#include "caf/unit.hpp"

#include <cstddef>
Expand All @@ -14,14 +15,6 @@

namespace caf::detail {

/// A list of types.
template <class... Ts>
struct type_list {
constexpr type_list() {
// nop
}
};

/// Denotes the empty list.
using empty_type_list = type_list<>;

Expand Down
4 changes: 2 additions & 2 deletions libcaf_core/caf/event_based_response_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#pragma once

#include "caf/detail/type_list.hpp"
#include "caf/message_id.hpp"
#include "caf/scheduled_actor.hpp"
#include "caf/type_list.hpp"

#include <type_traits>

Expand Down Expand Up @@ -77,7 +77,7 @@ class event_based_response_handle {
static_assert(std::is_same_v<typename on_error_trait::result_type, void>,
"OnError must return void");
using on_error_args = typename on_error_trait::decayed_arg_types;
static_assert(std::is_same_v<on_error_args, detail::type_list<error>>,
static_assert(std::is_same_v<on_error_args, type_list<error>>,
"OnError must accept a single argument of type caf::error");
}

Expand Down
6 changes: 3 additions & 3 deletions libcaf_core/caf/exec_main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ template <class>
struct exec_main_helper;

template <class System>
struct exec_main_helper<detail::type_list<System&>> {
struct exec_main_helper<type_list<System&>> {
using config = actor_system_config;

template <class F>
Expand All @@ -28,7 +28,7 @@ struct exec_main_helper<detail::type_list<System&>> {
};

template <class System, class Config>
struct exec_main_helper<detail::type_list<System&, const Config&>> {
struct exec_main_helper<type_list<System&, const Config&>> {
using config = Config;

template <class F>
Expand Down Expand Up @@ -128,7 +128,7 @@ auto do_init_host_system(type_list<Module...>, type_list<T, Ts...>) {
#define CAF_MAIN(...) \
int main(int argc, char** argv) { \
[[maybe_unused]] auto host_init_guard = caf::detail::do_init_host_system( \
caf::detail::type_list<>{}, caf::detail::type_list<__VA_ARGS__>{}); \
caf::type_list<>{}, caf::type_list<__VA_ARGS__>{}); \
caf::exec_main_init_meta_objects<__VA_ARGS__>(); \
caf::core::init_global_meta_objects(); \
return caf::exec_main<__VA_ARGS__>(caf_main, argc, argv); \
Expand Down
6 changes: 3 additions & 3 deletions libcaf_core/caf/flow/op/from_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ class from_generator_sub : public subscription::impl_base {
};

template <class Generator, class... Steps>
using from_generator_output_t = //
typename detail::tl_back_t< //
detail::type_list<Generator, Steps...> //
using from_generator_output_t = //
typename detail::tl_back_t< //
type_list<Generator, Steps...> //
>::output_type;

/// Converts a `Generator` to an @ref observable.
Expand Down
3 changes: 2 additions & 1 deletion libcaf_core/caf/flow/op/from_steps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "caf/detail/plain_ref_counted.hpp"
#include "caf/detail/scope_guard.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/flow/observer.hpp"

#include <deque>
#include <tuple>
Expand All @@ -17,7 +18,7 @@ namespace caf::flow::op {

template <class... Steps>
using from_steps_output_t =
typename detail::tl_back_t<detail::type_list<Steps...>>::output_type;
typename detail::tl_back_t<type_list<Steps...>>::output_type;

template <class Input, class... Steps>
class from_steps_sub : public subscription::impl_base,
Expand Down
11 changes: 5 additions & 6 deletions libcaf_core/caf/inspector_access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "caf/detail/as_mutable_ref.hpp"
#include "caf/detail/parse.hpp"
#include "caf/detail/print.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/error.hpp"
#include "caf/fwd.hpp"
#include "caf/inspector_access_base.hpp"
Expand All @@ -17,6 +16,7 @@
#include "caf/intrusive_ptr.hpp"
#include "caf/sec.hpp"
#include "caf/span.hpp"
#include "caf/type_list.hpp"

#include <chrono>
#include <cstddef>
Expand Down Expand Up @@ -594,24 +594,23 @@ struct variant_inspector_traits<std::variant<Ts...>> {
}

template <class F>
static bool load(type_id_t, F&, detail::type_list<>) {
static bool load(type_id_t, F&, type_list<>) {
return false;
}

template <class F, class U, class... Us>
static bool
load(type_id_t type, F& continuation, detail::type_list<U, Us...>) {
static bool load(type_id_t type, F& continuation, type_list<U, Us...>) {
if (type_id_v<U> == type) {
auto tmp = U{};
continuation(tmp);
return true;
}
return load(type, continuation, detail::type_list<Us...>{});
return load(type, continuation, type_list<Us...>{});
}

template <class F>
static bool load(type_id_t type, F continuation) {
return load(type, continuation, detail::type_list<Ts...>{});
return load(type, continuation, type_list<Ts...>{});
}
};

Expand Down
5 changes: 2 additions & 3 deletions libcaf_core/caf/interface_mismatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#pragma once

#include "caf/detail/type_list.hpp"
#include "caf/fwd.hpp"
#include "caf/type_list.hpp"

namespace caf::detail {

Expand Down Expand Up @@ -92,7 +92,6 @@ namespace caf {
/// first mismatch. Returns the number of elements on a match.
/// @pre len(Found) == len(Expected)
template <class Found, class Expected>
using interface_mismatch_t
= detail::imi<0, Found, Expected, detail::type_list<>>;
using interface_mismatch_t = detail::imi<0, Found, Expected, type_list<>>;

} // namespace caf
9 changes: 4 additions & 5 deletions libcaf_core/caf/policy/select_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

#include "caf/behavior.hpp"
#include "caf/config.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/typed_actor_util.hpp"
#include "caf/disposable.hpp"
#include "caf/error.hpp"
#include "caf/logger.hpp"
#include "caf/message_id.hpp"
#include "caf/type_list.hpp"

#include <cstddef>
#include <functional>
Expand Down Expand Up @@ -102,18 +102,17 @@ template <class F, class = typename detail::get_callable_trait<F>::arg_types>
struct select_select_all_helper;

template <class F, class... Ts>
struct select_select_all_helper<
F, detail::type_list<std::vector<std::tuple<Ts...>>>> {
struct select_select_all_helper<F, type_list<std::vector<std::tuple<Ts...>>>> {
using type = select_all_helper<F, Ts...>;
};

template <class F, class T>
struct select_select_all_helper<F, detail::type_list<std::vector<T>>> {
struct select_select_all_helper<F, type_list<std::vector<T>>> {
using type = select_all_helper<F, T>;
};

template <class F>
struct select_select_all_helper<F, detail::type_list<>> {
struct select_select_all_helper<F, type_list<>> {
using type = select_all_helper<F>;
};

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/policy/select_all.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct fixture : test::fixture::deterministic {

template <class... ResponseHandles>
auto fuse(ResponseHandles&... handles) {
return select_all<detail::type_list<int>>{
return select_all<type_list<int>>{
{handles.id()...},
disposable::make_composite({handles.policy().pending_timeouts()...})};
}
Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/policy/select_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include "caf/behavior.hpp"
#include "caf/config.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/typed_actor_util.hpp"
#include "caf/disposable.hpp"
#include "caf/logger.hpp"
#include "caf/sec.hpp"
#include "caf/type_list.hpp"

#include <cstddef>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/policy/select_any.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct fixture : test::fixture::deterministic {

template <class... ResponseHandles>
auto fuse(ResponseHandles&... handles) {
return select_any<detail::type_list<int>>{
return select_any<type_list<int>>{
{handles.id()...},
disposable::make_composite({handles.policy().pending_timeouts()...})};
}
Expand Down
1 change: 0 additions & 1 deletion libcaf_core/caf/policy/single_response.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "caf/behavior.hpp"
#include "caf/config.hpp"
#include "caf/detail/dispose_on_call.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/typed_actor_util.hpp"
#include "caf/disposable.hpp"
Expand Down

0 comments on commit 80ae89b

Please sign in to comment.