Commit bd0d7b98 authored by Dominik Charousset's avatar Dominik Charousset

Replace "typedef" with "using"

parent 870ed47e
...@@ -49,7 +49,7 @@ class execution_unit; ...@@ -49,7 +49,7 @@ class execution_unit;
* @brief A unique actor ID. * @brief A unique actor ID.
* @relates abstract_actor * @relates abstract_actor
*/ */
typedef uint32_t actor_id; using actor_id = uint32_t;
/** /**
* @brief Denotes an ID that is never used by an actor. * @brief Denotes an ID that is never used by an actor.
...@@ -60,7 +60,7 @@ class actor; ...@@ -60,7 +60,7 @@ class actor;
class abstract_actor; class abstract_actor;
class response_promise; class response_promise;
typedef intrusive_ptr<abstract_actor> abstract_actor_ptr; using abstract_actor_ptr = intrusive_ptr<abstract_actor>;
/** /**
* @brief Base class for all actor implementations. * @brief Base class for all actor implementations.
...@@ -262,8 +262,8 @@ struct functor_attachable : attachable { ...@@ -262,8 +262,8 @@ struct functor_attachable : attachable {
template<typename F> template<typename F>
bool abstract_actor::attach_functor(F&& f) { bool abstract_actor::attach_functor(F&& f) {
typedef typename detail::rm_const_and_ref<F>::type f_type; using f_type = typename detail::rm_const_and_ref<F>::type;
typedef functor_attachable<f_type> impl; using impl = functor_attachable<f_type>;
return attach(attachable_ptr{new impl(std::forward<F>(f))}); return attach(attachable_ptr{new impl(std::forward<F>(f))});
} }
......
...@@ -118,8 +118,8 @@ class abstract_group : public abstract_channel { ...@@ -118,8 +118,8 @@ class abstract_group : public abstract_channel {
}; };
typedef module* module_ptr; using module_ptr = module*;
typedef std::unique_ptr<module> unique_module_ptr; using unique_module_ptr = std::unique_ptr<module>;
virtual void serialize(serializer* sink) = 0; virtual void serialize(serializer* sink) = 0;
...@@ -160,7 +160,7 @@ class abstract_group : public abstract_channel { ...@@ -160,7 +160,7 @@ class abstract_group : public abstract_channel {
* @brief A smart pointer type that manages instances of {@link group}. * @brief A smart pointer type that manages instances of {@link group}.
* @relates group * @relates group
*/ */
typedef intrusive_ptr<abstract_group> abstract_group_ptr; using abstract_group_ptr = intrusive_ptr<abstract_group>;
} // namespace cppa } // namespace cppa
......
...@@ -30,7 +30,7 @@ class accept_handle : public io_handle<accept_handle> { ...@@ -30,7 +30,7 @@ class accept_handle : public io_handle<accept_handle> {
friend class io_handle<accept_handle>; friend class io_handle<accept_handle>;
typedef io_handle<accept_handle> super; using super = io_handle<accept_handle>;
public: public:
......
...@@ -44,13 +44,13 @@ class actor_companion : public extend<local_actor, actor_companion>:: ...@@ -44,13 +44,13 @@ class actor_companion : public extend<local_actor, actor_companion>::
with<behavior_stack_based<behavior>::impl, with<behavior_stack_based<behavior>::impl,
mixin::sync_sender<nonblocking_response_handle_tag>::impl> { mixin::sync_sender<nonblocking_response_handle_tag>::impl> {
typedef detail::shared_spinlock lock_type; using lock_type = detail::shared_spinlock;
public: public:
typedef std::unique_ptr<mailbox_element, detail::disposer> message_pointer; using message_pointer = std::unique_ptr<mailbox_element, detail::disposer>;
typedef std::function<void (message_pointer)> enqueue_handler; using enqueue_handler = std::function<void (message_pointer)>;
/** /**
* @brief Removes the handler for incoming messages and terminates * @brief Removes the handler for incoming messages and terminates
...@@ -81,7 +81,7 @@ class actor_companion : public extend<local_actor, actor_companion>:: ...@@ -81,7 +81,7 @@ class actor_companion : public extend<local_actor, actor_companion>::
* @brief A pointer to a co-existing (actor) object. * @brief A pointer to a co-existing (actor) object.
* @relates actor_companion * @relates actor_companion
*/ */
typedef intrusive_ptr<actor_companion> actor_companion_ptr; using actor_companion_ptr = intrusive_ptr<actor_companion>;
} // namespace cppa } // namespace cppa
......
...@@ -75,7 +75,7 @@ class actor_namespace { ...@@ -75,7 +75,7 @@ class actor_namespace {
/** /**
* @brief A map that stores all proxies for known remote actors. * @brief A map that stores all proxies for known remote actors.
*/ */
typedef std::map<actor_id, actor_proxy::anchor_ptr> proxy_map; using proxy_map = std::map<actor_id, actor_proxy::anchor_ptr>;
/** /**
* @brief Returns the number of proxies for @p node. * @brief Returns the number of proxies for @p node.
......
...@@ -32,7 +32,7 @@ class actor_ostream { ...@@ -32,7 +32,7 @@ class actor_ostream {
public: public:
typedef actor_ostream& (*fun_type)(actor_ostream&); using fun_type = actor_ostream& (*)(actor_ostream&);
actor_ostream(actor_ostream&&) = default; actor_ostream(actor_ostream&&) = default;
actor_ostream(const actor_ostream&) = default; actor_ostream(const actor_ostream&) = default;
......
...@@ -42,7 +42,7 @@ using actor_proxy_ptr = intrusive_ptr<actor_proxy>; ...@@ -42,7 +42,7 @@ using actor_proxy_ptr = intrusive_ptr<actor_proxy>;
*/ */
class actor_proxy : public abstract_actor { class actor_proxy : public abstract_actor {
typedef abstract_actor super; using super = abstract_actor;
public: public:
......
...@@ -143,7 +143,7 @@ std::pair<std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>, ...@@ -143,7 +143,7 @@ std::pair<std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>,
compound_member( compound_member(
const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>& gspair, const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>& gspair,
const Ts&... args) { const Ts&... args) {
typedef typename detail::rm_const_and_ref<GRes>::type mtype; using mtype = typename detail::rm_const_and_ref<GRes>::type;
return {gspair, new detail::default_uniform_type_info<mtype>(args...)}; return {gspair, new detail::default_uniform_type_info<mtype>(args...)};
} }
......
...@@ -81,7 +81,7 @@ class attachable { ...@@ -81,7 +81,7 @@ class attachable {
* @brief A managed {@link attachable} pointer. * @brief A managed {@link attachable} pointer.
* @relates attachable * @relates attachable
*/ */
typedef std::unique_ptr<attachable> attachable_ptr; using attachable_ptr = std::unique_ptr<attachable>;
} // namespace cppa } // namespace cppa
......
...@@ -44,11 +44,11 @@ class behavior { ...@@ -44,11 +44,11 @@ class behavior {
public: public:
typedef std::function<optional<message>(message&)> continuation_fun; using continuation_fun = std::function<optional<message>(message&)>;
/** @cond PRIVATE */ /** @cond PRIVATE */
typedef intrusive_ptr<detail::behavior_impl> impl_ptr; using impl_ptr = intrusive_ptr<detail::behavior_impl>;
inline auto as_behavior_impl() const -> const impl_ptr&; inline auto as_behavior_impl() const -> const impl_ptr&;
......
...@@ -33,8 +33,8 @@ struct is_behavior_policy : std::false_type {}; ...@@ -33,8 +33,8 @@ struct is_behavior_policy : std::false_type {};
template<bool DiscardBehavior> template<bool DiscardBehavior>
struct is_behavior_policy<behavior_policy<DiscardBehavior>> : std::true_type {}; struct is_behavior_policy<behavior_policy<DiscardBehavior>> : std::true_type {};
typedef behavior_policy<false> keep_behavior_t; using keep_behavior_t = behavior_policy<false>;
typedef behavior_policy<true> discard_behavior_t; using discard_behavior_t = behavior_policy<true>;
/** /**
* @brief Policy tag that causes {@link event_based_actor::become} to * @brief Policy tag that causes {@link event_based_actor::become} to
......
...@@ -33,22 +33,22 @@ namespace cppa { ...@@ -33,22 +33,22 @@ namespace cppa {
template<class Base, class Subtype, class BehaviorType> template<class Base, class Subtype, class BehaviorType>
class behavior_stack_based_impl : public single_timeout<Base, Subtype> { class behavior_stack_based_impl : public single_timeout<Base, Subtype> {
typedef single_timeout<Base, Subtype> super; using super = single_timeout<Base, Subtype>;
public: public:
/************************************************************************** /**************************************************************************
* typedefs and constructor * * types and constructor *
**************************************************************************/ **************************************************************************/
typedef BehaviorType behavior_type; using behavior_type = BehaviorType;
typedef behavior_stack_based_impl combined_type; using combined_type = behavior_stack_based_impl;
typedef response_handle<behavior_stack_based_impl, using response_handle_type = response_handle<
behavior_stack_based_impl,
message, message,
nonblocking_response_handle_tag> nonblocking_response_handle_tag>;
response_handle_type;
template<typename... Ts> template<typename... Ts>
behavior_stack_based_impl(Ts&&... vs) : super(std::forward<Ts>(vs)...) { } behavior_stack_based_impl(Ts&&... vs) : super(std::forward<Ts>(vs)...) { }
...@@ -175,11 +175,11 @@ class behavior_stack_based { ...@@ -175,11 +175,11 @@ class behavior_stack_based {
template<class Base, class Subtype> template<class Base, class Subtype>
class impl : public behavior_stack_based_impl<Base, Subtype, BehaviorType> { class impl : public behavior_stack_based_impl<Base, Subtype, BehaviorType> {
typedef behavior_stack_based_impl<Base, Subtype, BehaviorType> super; using super = behavior_stack_based_impl<Base, Subtype, BehaviorType>;
public: public:
typedef impl combined_type; using combined_type = impl;
template<typename... Ts> template<typename... Ts>
impl(Ts&&... args) : super(std::forward<Ts>(args)...) { } impl(Ts&&... args) : super(std::forward<Ts>(args)...) { }
......
...@@ -29,7 +29,7 @@ namespace cppa { ...@@ -29,7 +29,7 @@ namespace cppa {
*/ */
class binary_deserializer : public deserializer { class binary_deserializer : public deserializer {
typedef deserializer super; using super = deserializer;
public: public:
......
...@@ -51,7 +51,7 @@ class blocking_actor ...@@ -51,7 +51,7 @@ class blocking_actor
/************************************************************************** /**************************************************************************
* utility stuff and receive() member function family * * utility stuff and receive() member function family *
**************************************************************************/ **************************************************************************/
typedef std::chrono::high_resolution_clock::time_point timeout_type; using timeout_type = std::chrono::high_resolution_clock::time_point;
struct receive_while_helper { struct receive_while_helper {
...@@ -250,7 +250,7 @@ class blocking_actor::functor_based : public blocking_actor { ...@@ -250,7 +250,7 @@ class blocking_actor::functor_based : public blocking_actor {
public: public:
typedef std::function<void(blocking_actor*)> act_fun; using act_fun = std::function<void(blocking_actor*)>;
template<typename F, typename... Ts> template<typename F, typename... Ts>
functor_based(F f, Ts&&... vs) { functor_based(F f, Ts&&... vs) {
......
...@@ -30,7 +30,7 @@ class connection_handle : public io_handle<connection_handle> { ...@@ -30,7 +30,7 @@ class connection_handle : public io_handle<connection_handle> {
friend class io_handle<connection_handle>; friend class io_handle<connection_handle>;
typedef io_handle<connection_handle> super; using super = io_handle<connection_handle>;
public: public:
......
...@@ -38,7 +38,7 @@ class continue_helper { ...@@ -38,7 +38,7 @@ class continue_helper {
public: public:
typedef int message_id_wrapper_tag; using message_id_wrapper_tag = int;
continue_helper(message_id mid, local_actor* self); continue_helper(message_id mid, local_actor* self);
......
...@@ -43,11 +43,11 @@ class cow_ptr : util::comparable<cow_ptr<T>>, ...@@ -43,11 +43,11 @@ class cow_ptr : util::comparable<cow_ptr<T>>,
public: public:
typedef T* pointer; using pointer = T*;
typedef const T* const_pointer; using const_pointer = const T*;
typedef T element_type; using element_type = T;
typedef T& reference; using reference = T&;
typedef const T& const_reference; using const_reference = const T&;
constexpr cow_ptr() : m_ptr() { } constexpr cow_ptr() : m_ptr() { }
......
...@@ -58,7 +58,7 @@ class cow_tuple<Head, Tail...> { ...@@ -58,7 +58,7 @@ class cow_tuple<Head, Tail...> {
public: public:
typedef detail::type_list<Head, Tail...> types; using types = detail::type_list<Head, Tail...>;
static constexpr size_t num_elements = sizeof...(Tail) + 1; static constexpr size_t num_elements = sizeof...(Tail) + 1;
...@@ -147,7 +147,7 @@ struct cow_tuple_from_type_list; ...@@ -147,7 +147,7 @@ struct cow_tuple_from_type_list;
template<typename... Ts> template<typename... Ts>
struct cow_tuple_from_type_list< detail::type_list<Ts...>> { struct cow_tuple_from_type_list< detail::type_list<Ts...>> {
typedef cow_tuple<Ts...> type; using type = cow_tuple<Ts...>;
}; };
template<typename T> template<typename T>
...@@ -166,7 +166,7 @@ struct is_cow_tuple<cow_tuple<Ts...>> { static constexpr bool value = true; }; ...@@ -166,7 +166,7 @@ struct is_cow_tuple<cow_tuple<Ts...>> { static constexpr bool value = true; };
*/ */
template<size_t N, typename... Ts> template<size_t N, typename... Ts>
const typename detail::type_at<N, Ts...>::type& get(const cow_tuple<Ts...>& tup) { const typename detail::type_at<N, Ts...>::type& get(const cow_tuple<Ts...>& tup) {
typedef typename detail::type_at<N, Ts...>::type result_type; using result_type = typename detail::type_at<N, Ts...>::type;
return *reinterpret_cast<const result_type*>(tup.at(N)); return *reinterpret_cast<const result_type*>(tup.at(N));
} }
...@@ -181,7 +181,7 @@ const typename detail::type_at<N, Ts...>::type& get(const cow_tuple<Ts...>& tup) ...@@ -181,7 +181,7 @@ const typename detail::type_at<N, Ts...>::type& get(const cow_tuple<Ts...>& tup)
*/ */
template<size_t N, typename... Ts> template<size_t N, typename... Ts>
typename detail::type_at<N, Ts...>::type& get_ref(cow_tuple<Ts...>& tup) { typename detail::type_at<N, Ts...>::type& get_ref(cow_tuple<Ts...>& tup) {
typedef typename detail::type_at<N, Ts...>::type result_type; using result_type = typename detail::type_at<N, Ts...>::type;
return *reinterpret_cast<result_type*>(tup.mutable_at(N)); return *reinterpret_cast<result_type*>(tup.mutable_at(N));
} }
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#ifndef CPPA_CPPA_HPP #ifndef CPPA_CPPA_HPP
#define CPPA_CPPA_HPP #define CPPA_CPPA_HPP
// this header has been deprecated, forward to new header // <backward_compatibility version="0.9" whole_file="yes">
#include "cppa/all.hpp" #include "cppa/all.hpp"
// </backward_compatibility>
#endif // CPPA_CPPA_HPP #endif // CPPA_CPPA_HPP
...@@ -20,54 +20,8 @@ ...@@ -20,54 +20,8 @@
#ifndef CPPA_CPPA_FWD_HPP #ifndef CPPA_CPPA_FWD_HPP
#define CPPA_CPPA_FWD_HPP #define CPPA_CPPA_FWD_HPP
#include <cstdint> // <backward_compatibility version="0.9" whole_file="yes">
#include "cppa/fwd.hpp"
namespace cppa { // </backward_compatibility>
// classes
class actor;
class group;
class channel;
class node_id;
class behavior;
class resumable;
class message;
class actor_addr;
class actor_proxy;
class scoped_actor;
class execution_unit;
class abstract_actor;
class abstract_group;
class blocking_actor;
class message_header;
class message_handler;
class uniform_type_info;
class event_based_actor;
class primitive_variant;
// structs
struct anything;
// enums
enum primitive_type : unsigned char;
enum class atom_value : std::uint64_t;
// class templates
template<typename> class optional;
template<typename> class intrusive_ptr;
template<typename> class weak_intrusive_ptr;
// intrusive pointer typedefs
typedef intrusive_ptr<abstract_group> abstract_group_ptr;
typedef intrusive_ptr<actor_proxy> actor_proxy_ptr;
typedef intrusive_ptr<node_id> node_id_ptr;
// weak intrusive pointer typedefs
typedef weak_intrusive_ptr<actor_proxy> weak_actor_proxy_ptr;
// convenience typedefs
typedef const message_header& msg_hdr_cref;
} // namespace cppa
#endif // CPPA_CPPA_FWD_HPP #endif // CPPA_CPPA_FWD_HPP
...@@ -50,7 +50,7 @@ class actor_registry : public singleton_mixin<actor_registry> { ...@@ -50,7 +50,7 @@ class actor_registry : public singleton_mixin<actor_registry> {
* exit reason. An entry with a nullptr means the actor has finished * exit reason. An entry with a nullptr means the actor has finished
* execution for given reason. * execution for given reason.
*/ */
typedef std::pair<abstract_actor_ptr, uint32_t> value_type; using value_type = std::pair<abstract_actor_ptr, uint32_t>;
/** /**
* @brief Returns the {nullptr, invalid_exit_reason}. * @brief Returns the {nullptr, invalid_exit_reason}.
...@@ -82,7 +82,7 @@ class actor_registry : public singleton_mixin<actor_registry> { ...@@ -82,7 +82,7 @@ class actor_registry : public singleton_mixin<actor_registry> {
private: private:
typedef std::map<actor_id, value_type> entries; using entries = std::map<actor_id, value_type>;
std::atomic<size_t> m_running; std::atomic<size_t> m_running;
std::atomic<actor_id> m_ids; std::atomic<actor_id> m_ids;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
namespace cppa { namespace cppa {
class message_handler; class message_handler;
typedef optional<message> bhvr_invoke_result; using bhvr_invoke_result = optional<message>;
} // namespace cppa } // namespace cppa
...@@ -152,7 +152,7 @@ class behavior_impl : public ref_counted { ...@@ -152,7 +152,7 @@ class behavior_impl : public ref_counted {
virtual void handle_timeout(); virtual void handle_timeout();
inline const duration& timeout() const { return m_timeout; } inline const duration& timeout() const { return m_timeout; }
typedef intrusive_ptr<behavior_impl> pointer; using pointer = intrusive_ptr<behavior_impl>;
virtual pointer copy(const generic_timeout_definition& tdef) const = 0; virtual pointer copy(const generic_timeout_definition& tdef) const = 0;
...@@ -202,7 +202,7 @@ struct dummy_match_expr { ...@@ -202,7 +202,7 @@ struct dummy_match_expr {
template<class MatchExpr, typename F> template<class MatchExpr, typename F>
class default_behavior_impl : public behavior_impl { class default_behavior_impl : public behavior_impl {
typedef behavior_impl super; using super = behavior_impl;
public: public:
...@@ -256,7 +256,7 @@ default_behavior_impl<dummy_match_expr, F>* new_default_behavior(duration d, ...@@ -256,7 +256,7 @@ default_behavior_impl<dummy_match_expr, F>* new_default_behavior(duration d,
f); f);
} }
typedef intrusive_ptr<behavior_impl> behavior_impl_ptr; using behavior_impl_ptr = intrusive_ptr<behavior_impl>;
// implemented in message_handler.cpp // implemented in message_handler.cpp
// message_handler combine(behavior_impl_ptr, behavior_impl_ptr); // message_handler combine(behavior_impl_ptr, behavior_impl_ptr);
......
...@@ -43,7 +43,7 @@ class behavior_stack { ...@@ -43,7 +43,7 @@ class behavior_stack {
behavior_stack(const behavior_stack&) = delete; behavior_stack(const behavior_stack&) = delete;
behavior_stack& operator=(const behavior_stack&) = delete; behavior_stack& operator=(const behavior_stack&) = delete;
typedef std::pair<behavior, message_id> element_type; using element_type = std::pair<behavior, message_id>;
public: public:
......
...@@ -27,19 +27,19 @@ namespace detail { ...@@ -27,19 +27,19 @@ namespace detail {
template<typename T> template<typename T>
struct boxed { struct boxed {
typedef detail::wrapped<T> type; using type = detail::wrapped<T>;
}; };
template<typename T> template<typename T>
struct boxed<detail::wrapped<T>> { struct boxed<detail::wrapped<T>> {
typedef detail::wrapped<T> type; using type = detail::wrapped<T>;
}; };
template<> template<>
struct boxed<anything> { struct boxed<anything> {
typedef anything type; using type = anything;
}; };
......
...@@ -36,17 +36,17 @@ namespace detail { ...@@ -36,17 +36,17 @@ namespace detail {
class decorated_tuple : public message_data { class decorated_tuple : public message_data {
typedef message_data super; using super = message_data;
decorated_tuple& operator=(const decorated_tuple&) = delete; decorated_tuple& operator=(const decorated_tuple&) = delete;
public: public:
typedef std::vector<size_t> vector_type; using vector_type = std::vector<size_t>;
typedef message_data::ptr pointer; using pointer = message_data::ptr;
typedef const std::type_info* rtti; using rtti = const std::type_info*;
// creates a dynamically typed subtuple from @p d with an offset // creates a dynamically typed subtuple from @p d with an offset
static inline pointer create(pointer d, vector_type v) { static inline pointer create(pointer d, vector_type v) {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
namespace cppa { namespace cppa {
namespace detail { namespace detail {
typedef uniform_type_info_ptr uniform_type_info_ptr; using uniform_type_info_ptr = uniform_type_info_ptr;
// check if there's a 'push_back' that takes a C::value_type // check if there's a 'push_back' that takes a C::value_type
template<typename T> template<typename T>
...@@ -76,11 +76,11 @@ struct is_stl_pair : std::false_type {}; ...@@ -76,11 +76,11 @@ struct is_stl_pair : std::false_type {};
template<typename F, typename S> template<typename F, typename S>
struct is_stl_pair<std::pair<F, S>> : std::true_type {}; struct is_stl_pair<std::pair<F, S>> : std::true_type {};
typedef std::integral_constant<int, 0> primitive_impl; using primitive_impl = std::integral_constant<int, 0>;
typedef std::integral_constant<int, 1> list_impl; using list_impl = std::integral_constant<int, 1>;
typedef std::integral_constant<int, 2> map_impl; using map_impl = std::integral_constant<int, 2>;
typedef std::integral_constant<int, 3> pair_impl; using pair_impl = std::integral_constant<int, 3>;
typedef std::integral_constant<int, 9> recursive_impl; using recursive_impl = std::integral_constant<int, 9>;
template<typename T> template<typename T>
constexpr int impl_id() { constexpr int impl_id() {
...@@ -95,15 +95,15 @@ constexpr int impl_id() { ...@@ -95,15 +95,15 @@ constexpr int impl_id() {
template<typename T> template<typename T>
struct deconst_pair { struct deconst_pair {
typedef T type; using type = T;
}; };
template<typename K, typename V> template<typename K, typename V>
struct deconst_pair<std::pair<K, V>> { struct deconst_pair<std::pair<K, V>> {
typedef typename std::remove_const<K>::type first_type; using first_type = typename std::remove_const<K>::type;
typedef typename std::remove_const<V>::type second_type; using second_type = typename std::remove_const<V>::type;
typedef std::pair<first_type, second_type> type; using type = std::pair<first_type, second_type>;
}; };
...@@ -165,7 +165,7 @@ class default_serialize_policy { ...@@ -165,7 +165,7 @@ class default_serialize_policy {
template<typename T> template<typename T>
void dimpl(T& storage, deserializer* d, list_impl) const { void dimpl(T& storage, deserializer* d, list_impl) const {
typedef typename T::value_type value_type; using value_type = typename T::value_type;
storage.clear(); storage.clear();
size_t size = d->begin_sequence(); size_t size = d->begin_sequence();
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
...@@ -287,7 +287,7 @@ template<typename T, class AccessPolicy, class SerializePolicy> ...@@ -287,7 +287,7 @@ template<typename T, class AccessPolicy, class SerializePolicy>
class member_tinfo<T, AccessPolicy, SerializePolicy, true, class member_tinfo<T, AccessPolicy, SerializePolicy, true,
false> : public detail::abstract_uniform_type_info<T> { false> : public detail::abstract_uniform_type_info<T> {
typedef typename std::underlying_type<T>::type value_type; using value_type = typename std::underlying_type<T>::type;
public: public:
...@@ -349,8 +349,8 @@ class getter_setter_access_policy { ...@@ -349,8 +349,8 @@ class getter_setter_access_policy {
public: public:
typedef GRes (C::*getter)() const; using getter = GRes (C::*)() const;
typedef SRes (C::*setter)(SArg); using setter = SRes (C::*)(SArg);
getter_setter_access_policy(getter g, setter s) : m_get(g), m_set(s) {} getter_setter_access_policy(getter g, setter s) : m_get(g), m_set(s) {}
...@@ -396,25 +396,25 @@ struct fake_access_policy { ...@@ -396,25 +396,25 @@ struct fake_access_policy {
template<typename T, class C> template<typename T, class C>
uniform_type_info_ptr new_member_tinfo(T C::*memptr) { uniform_type_info_ptr new_member_tinfo(T C::*memptr) {
typedef memptr_access_policy<T, C> access_policy; using access_policy = memptr_access_policy<T, C>;
typedef member_tinfo<T, access_policy> result_type; using result_type = member_tinfo<T, access_policy>;
return uniform_type_info_ptr(new result_type(memptr)); return uniform_type_info_ptr(new result_type(memptr));
} }
template<typename T, class C> template<typename T, class C>
uniform_type_info_ptr new_member_tinfo(T C::*memptr, uniform_type_info_ptr new_member_tinfo(T C::*memptr,
uniform_type_info_ptr meminf) { uniform_type_info_ptr meminf) {
typedef memptr_access_policy<T, C> access_policy; using access_policy = memptr_access_policy<T, C>;
typedef member_tinfo<T, access_policy, forwarding_serialize_policy> tinfo; using tinfo = member_tinfo<T, access_policy, forwarding_serialize_policy>;
return uniform_type_info_ptr(new tinfo(memptr, std::move(meminf))); return uniform_type_info_ptr(new tinfo(memptr, std::move(meminf)));
} }
template<class C, typename GRes, typename SRes, typename SArg> template<class C, typename GRes, typename SRes, typename SArg>
uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const, uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const,
SRes (C::*setter)(SArg)) { SRes (C::*setter)(SArg)) {
typedef getter_setter_access_policy<C, GRes, SRes, SArg> access_policy; using access_policy = getter_setter_access_policy<C, GRes, SRes, SArg>;
typedef typename detail::rm_const_and_ref<GRes>::type value_type; using value_type = typename detail::rm_const_and_ref<GRes>::type;
typedef member_tinfo<value_type, access_policy> result_type; using result_type = member_tinfo<value_type, access_policy>;
return uniform_type_info_ptr( return uniform_type_info_ptr(
new result_type(access_policy(getter, setter))); new result_type(access_policy(getter, setter)));
} }
...@@ -423,10 +423,10 @@ template<class C, typename GRes, typename SRes, typename SArg> ...@@ -423,10 +423,10 @@ template<class C, typename GRes, typename SRes, typename SArg>
uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const, uniform_type_info_ptr new_member_tinfo(GRes (C::*getter)() const,
SRes (C::*setter)(SArg), SRes (C::*setter)(SArg),
uniform_type_info_ptr meminf) { uniform_type_info_ptr meminf) {
typedef getter_setter_access_policy<C, GRes, SRes, SArg> access_policy; using access_policy = getter_setter_access_policy<C, GRes, SRes, SArg>;
typedef typename detail::rm_const_and_ref<GRes>::type value_type; using value_type = typename detail::rm_const_and_ref<GRes>::type;
typedef member_tinfo<value_type, access_policy, forwarding_serialize_policy> using tinfo = member_tinfo<value_type, access_policy,
tinfo; forwarding_serialize_policy>;
return uniform_type_info_ptr( return uniform_type_info_ptr(
new tinfo(access_policy(getter, setter), std::move(meminf))); new tinfo(access_policy(getter, setter), std::move(meminf)));
} }
...@@ -442,7 +442,7 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> { ...@@ -442,7 +442,7 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> {
} }
default_uniform_type_info() { default_uniform_type_info() {
typedef member_tinfo<T, fake_access_policy<T>> result_type; using result_type = member_tinfo<T, fake_access_policy<T>>;
m_members.push_back(uniform_type_info_ptr(new result_type)); m_members.push_back(uniform_type_info_ptr(new result_type));
} }
...@@ -535,7 +535,7 @@ class default_uniform_type_info<typed_actor< ...@@ -535,7 +535,7 @@ class default_uniform_type_info<typed_actor<
public: public:
typedef typed_actor<Rs...> handle_type; using handle_type = typed_actor<Rs...>;
default_uniform_type_info() { sub_uti = uniform_typeid<actor>(); } default_uniform_type_info() { sub_uti = uniform_typeid<actor>(); }
......
...@@ -50,8 +50,8 @@ class group_manager : public singleton_mixin<group_manager> { ...@@ -50,8 +50,8 @@ class group_manager : public singleton_mixin<group_manager> {
private: private:
typedef std::map<std::string, abstract_group::unique_module_ptr> using modules_map = std::map<std::string,
modules_map; abstract_group::unique_module_ptr>;
modules_map m_mmap; modules_map m_mmap;
std::mutex m_mmap_mtx; std::mutex m_mmap_mtx;
......
...@@ -64,8 +64,8 @@ struct ieee_754_trait<uint64_t> : ieee_754_trait<double> {}; ...@@ -64,8 +64,8 @@ struct ieee_754_trait<uint64_t> : ieee_754_trait<double> {};
template<typename T> template<typename T>
typename ieee_754_trait<T>::packed_type pack754(T f) { typename ieee_754_trait<T>::packed_type pack754(T f) {
typedef ieee_754_trait<T> trait; using trait = ieee_754_trait<T>;
typedef typename trait::packed_type result_type; using result_type = typename trait::packed_type;
// filter special type // filter special type
if (fabs(f) <= trait::zero) return 0; // only true if f equals +0 or -0 if (fabs(f) <= trait::zero) return 0; // only true if f equals +0 or -0
auto significandbits = trait::bits - trait::expbits - 1; // -1 for sign bit auto significandbits = trait::bits - trait::expbits - 1; // -1 for sign bit
...@@ -103,9 +103,9 @@ typename ieee_754_trait<T>::packed_type pack754(T f) { ...@@ -103,9 +103,9 @@ typename ieee_754_trait<T>::packed_type pack754(T f) {
template<typename T> template<typename T>
typename ieee_754_trait<T>::float_type unpack754(T i) { typename ieee_754_trait<T>::float_type unpack754(T i) {
typedef ieee_754_trait<T> trait; using trait = ieee_754_trait<T>;
typedef typename trait::signed_packed_type signed_type; using signed_type = typename trait::signed_packed_type;
typedef typename trait::float_type result_type; using result_type = typename trait::float_type;
if (i == 0) return trait::zero; if (i == 0) return trait::zero;
auto significandbits = trait::bits - trait::expbits - 1; // -1 for sign bit auto significandbits = trait::bits - trait::expbits - 1; // -1 for sign bit
// pull the significand // pull the significand
......
...@@ -34,7 +34,7 @@ namespace detail { ...@@ -34,7 +34,7 @@ namespace detail {
template<typename T> template<typename T>
struct implicit_conversions { struct implicit_conversions {
typedef typename replace_type< using subtype1 = typename replace_type<
T, T,
std::string, std::string,
std::is_same<T, const char*>, std::is_same<T, const char*>,
...@@ -42,44 +42,38 @@ struct implicit_conversions { ...@@ -42,44 +42,38 @@ struct implicit_conversions {
std::is_same<T, char[]>, std::is_same<T, char[]>,
is_array_of<T, char>, is_array_of<T, char>,
is_array_of<T, const char> is_array_of<T, const char>
>::type >::type;
subtype1;
typedef typename replace_type< using subtype2 = typename replace_type<
subtype1, subtype1,
std::u16string, std::u16string,
std::is_same<subtype1, const char16_t*>, std::is_same<subtype1, const char16_t*>,
std::is_same<subtype1, char16_t*>, std::is_same<subtype1, char16_t*>,
is_array_of<subtype1, char16_t> is_array_of<subtype1, char16_t>
>::type >::type;
subtype2;
typedef typename replace_type< using subtype3 = typename replace_type<
subtype2, subtype2,
std::u32string, std::u32string,
std::is_same<subtype2, const char32_t*>, std::is_same<subtype2, const char32_t*>,
std::is_same<subtype2, char32_t*>, std::is_same<subtype2, char32_t*>,
is_array_of<subtype2, char32_t> is_array_of<subtype2, char32_t>
>::type >::type;
subtype3;
typedef typename replace_type< using type = typename replace_type<
subtype3, subtype3,
actor, actor,
std::is_convertible<T, abstract_actor*>, std::is_convertible<T, abstract_actor*>,
std::is_same<scoped_actor, T> std::is_same<scoped_actor, T>
>::type >::type;
type;
}; };
template<typename T> template<typename T>
struct strip_and_convert { struct strip_and_convert {
typedef typename implicit_conversions< using type = typename implicit_conversions<
typename rm_const_and_ref<T>::type typename rm_const_and_ref<T>::type
>::type >::type;
type;
}; };
} // namespace detail } // namespace detail
......
...@@ -40,7 +40,7 @@ struct il_right_impl; ...@@ -40,7 +40,7 @@ struct il_right_impl;
template<size_t N, size_t Size> template<size_t N, size_t Size>
struct il_right_impl<N, Size> { struct il_right_impl<N, Size> {
typedef int_list<> type; using type = int_list<>;
}; };
template<size_t N, size_t Size, long I, long... Is> template<size_t N, size_t Size, long I, long... Is>
...@@ -48,7 +48,7 @@ struct il_right_impl<N, Size, I, Is...> : il_right_impl<N, Size - 1, Is...> { }; ...@@ -48,7 +48,7 @@ struct il_right_impl<N, Size, I, Is...> : il_right_impl<N, Size - 1, Is...> { };
template<size_t N, long I, long... Is> template<size_t N, long I, long... Is>
struct il_right_impl<N, N, I, Is...> { struct il_right_impl<N, N, I, Is...> {
typedef int_list<I, Is...> type; using type = int_list<I, Is...>;
}; };
template<class List, size_t N> template<class List, size_t N>
...@@ -69,7 +69,7 @@ struct il_indices; ...@@ -69,7 +69,7 @@ struct il_indices;
template<template<class...> class List, long... Is, long Pos> template<template<class...> class List, long... Is, long Pos>
struct il_indices<List<>, Pos, int_list<Is...>> { struct il_indices<List<>, Pos, int_list<Is...>> {
typedef int_list<Is...> type; using type = int_list<Is...>;
}; };
template<template<class...> class List, template<template<class...> class List,
...@@ -79,12 +79,11 @@ template<template<class...> class List, ...@@ -79,12 +79,11 @@ template<template<class...> class List,
long... Is> long... Is>
struct il_indices<List<T0, Ts...>, Pos, int_list<Is...>> { struct il_indices<List<T0, Ts...>, Pos, int_list<Is...>> {
// always use type_list to forward remaining Ts... arguments // always use type_list to forward remaining Ts... arguments
typedef typename il_indices< using type = typename il_indices<
type_list<Ts...>, type_list<Ts...>,
Pos + 1, Pos + 1,
int_list<Is..., Pos> int_list<Is..., Pos>
>::type >::type;
type;
}; };
......
...@@ -29,25 +29,25 @@ namespace detail { ...@@ -29,25 +29,25 @@ namespace detail {
*/ */
template<typename Left, typename Right> template<typename Left, typename Right>
struct left_or_right { struct left_or_right {
typedef Left type; using type = Left;
}; };
template<typename Right> template<typename Right>
struct left_or_right<unit_t, Right> { struct left_or_right<unit_t, Right> {
typedef Right type; using type = Right;
}; };
template<typename Right> template<typename Right>
struct left_or_right<unit_t&, Right> { struct left_or_right<unit_t&, Right> {
typedef Right type; using type = Right;
}; };
template<typename Right> template<typename Right>
struct left_or_right<const unit_t&, Right> { struct left_or_right<const unit_t&, Right> {
typedef Right type; using type = Right;
}; };
...@@ -56,13 +56,13 @@ struct left_or_right<const unit_t&, Right> { ...@@ -56,13 +56,13 @@ struct left_or_right<const unit_t&, Right> {
*/ */
template<typename Left, typename Right> template<typename Left, typename Right>
struct if_not_left { struct if_not_left {
typedef unit_t type; using type = unit_t;
}; };
template<typename Right> template<typename Right>
struct if_not_left<unit_t, Right> { struct if_not_left<unit_t, Right> {
typedef Right type; using type = Right;
}; };
......
...@@ -79,7 +79,7 @@ inline bool has_none(const optional<T>& v, const Ts&... vs) { ...@@ -79,7 +79,7 @@ inline bool has_none(const optional<T>& v, const Ts&... vs) {
template<typename R, typename F> template<typename R, typename F>
class lifted_fun_invoker { class lifted_fun_invoker {
typedef typename get_callable_trait<F>::arg_types arg_types; using arg_types = typename get_callable_trait<F>::arg_types;
static constexpr size_t args = tl_size<arg_types>::value; static constexpr size_t args = tl_size<arg_types>::value;
...@@ -110,7 +110,7 @@ class lifted_fun_invoker { ...@@ -110,7 +110,7 @@ class lifted_fun_invoker {
template<typename F> template<typename F>
class lifted_fun_invoker<bool, F> { class lifted_fun_invoker<bool, F> {
typedef typename get_callable_trait<F>::arg_types arg_types; using arg_types = typename get_callable_trait<F>::arg_types;
static constexpr size_t args = tl_size<arg_types>::value; static constexpr size_t args = tl_size<arg_types>::value;
...@@ -150,19 +150,20 @@ class lifted_fun { ...@@ -150,19 +150,20 @@ class lifted_fun {
public: public:
typedef typename get_callable_trait<F>::result_type result_type; using result_type = typename get_callable_trait<F>::result_type;
// Let F be "R (Ts...)" then lifted_fun<F...> returns optional<R> // Let F be "R (Ts...)" then lifted_fun<F...> returns optional<R>
// unless R is void in which case bool is returned // unless R is void in which case bool is returned
typedef typename std::conditional<std::is_same<result_type, void>::value, using optional_result_type = typename std::conditional<
bool, optional<result_type>>::type std::is_same<result_type, void>::value,
optional_result_type; bool, optional<result_type>
>::type;
typedef ListOfProjections projections_list; using projections_list = ListOfProjections;
typedef typename tl_apply<projections_list, std::tuple>::type projections; using projections = typename tl_apply<projections_list, std::tuple>::type;
typedef type_list<Args...> arg_types; using arg_types = type_list<Args...>;
lifted_fun() = default; lifted_fun() = default;
...@@ -204,7 +205,7 @@ struct get_lifted_fun; ...@@ -204,7 +205,7 @@ struct get_lifted_fun;
template<typename F, class ListOfProjections, typename... Ts> template<typename F, class ListOfProjections, typename... Ts>
struct get_lifted_fun<F, ListOfProjections, type_list<Ts...>> { struct get_lifted_fun<F, ListOfProjections, type_list<Ts...>> {
typedef lifted_fun<F, ListOfProjections, Ts...> type; using type = lifted_fun<F, ListOfProjections, Ts...>;
}; };
......
...@@ -49,18 +49,18 @@ class limited_vector { ...@@ -49,18 +49,18 @@ class limited_vector {
public: public:
typedef T value_type; using value_type = T;
typedef size_t size_type; using size_type = size_t;
typedef ptrdiff_t difference_type; using difference_type = ptrdiff_t;
typedef value_type& reference; using reference = value_type&;
typedef const value_type& const_reference; using const_reference = const value_type&;
typedef value_type* pointer; using pointer = value_type*;
typedef const value_type* const_pointer; using const_pointer = const value_type*;
typedef T* iterator; using iterator = T*;
typedef const T* const_iterator; using const_iterator = const T*;
typedef std::reverse_iterator<iterator> reverse_iterator; using reverse_iterator = std::reverse_iterator<iterator>;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; using const_reverse_iterator = std::reverse_iterator<const_iterator>;
inline limited_vector() : m_size(0) { } inline limited_vector() : m_size(0) { }
......
...@@ -241,9 +241,9 @@ struct select_matcher; ...@@ -241,9 +241,9 @@ struct select_matcher;
template<class Tuple, typename... Ts> template<class Tuple, typename... Ts>
struct select_matcher<Tuple, detail::type_list<Ts...>> { struct select_matcher<Tuple, detail::type_list<Ts...>> {
typedef matcher<get_wildcard_position<detail::type_list<Ts...>>(), Tuple, using type = matcher<get_wildcard_position<detail::type_list<Ts...>>(),
Ts...> type; Tuple,
Ts...>;
}; };
} // namespace detail } // namespace detail
......
...@@ -142,7 +142,7 @@ class basic_memory_cache : public memory_cache { ...@@ -142,7 +142,7 @@ class basic_memory_cache : public memory_cache {
} }
} }
typedef wrapper* iterator; using iterator = wrapper*;
iterator begin() { return data; } iterator begin() { return data; }
......
...@@ -73,7 +73,7 @@ class message_data : public ref_counted { ...@@ -73,7 +73,7 @@ class message_data : public ref_counted {
bool equals(const message_data& other) const; bool equals(const message_data& other) const;
typedef message_iterator<message_data> const_iterator; using const_iterator = message_iterator<message_data>;
inline const_iterator begin() const { inline const_iterator begin() const {
return {this}; return {this};
......
...@@ -32,7 +32,7 @@ namespace detail { ...@@ -32,7 +32,7 @@ namespace detail {
template<typename T> template<typename T>
struct conv_arg_impl { struct conv_arg_impl {
typedef optional<T> result_type; using result_type = optional<T>;
static inline result_type _(const std::string& arg) { static inline result_type _(const std::string& arg) {
std::istringstream iss(arg); std::istringstream iss(arg);
T result; T result;
...@@ -45,7 +45,7 @@ struct conv_arg_impl { ...@@ -45,7 +45,7 @@ struct conv_arg_impl {
template<> template<>
struct conv_arg_impl<std::string> { struct conv_arg_impl<std::string> {
typedef optional<std::string> result_type; using result_type = optional<std::string>;
static inline result_type _(const std::string& arg) { return arg; } static inline result_type _(const std::string& arg) { return arg; }
}; };
...@@ -64,7 +64,7 @@ class rd_arg_functor { ...@@ -64,7 +64,7 @@ class rd_arg_functor {
template<bool> friend class opt1_rvalue_builder; template<bool> friend class opt1_rvalue_builder;
typedef rd_arg_storage<T> storage_type; using storage_type = rd_arg_storage<T>;
public: public:
...@@ -108,8 +108,8 @@ class add_arg_functor { ...@@ -108,8 +108,8 @@ class add_arg_functor {
public: public:
typedef std::vector<T> value_type; using value_type = std::vector<T>;
typedef rd_arg_storage<value_type> storage_type; using storage_type = rd_arg_storage<value_type>;
add_arg_functor(const add_arg_functor&) = default; add_arg_functor(const add_arg_functor&) = default;
...@@ -143,17 +143,17 @@ struct is_rd_arg<rd_arg_functor<T>> : std::true_type { }; ...@@ -143,17 +143,17 @@ struct is_rd_arg<rd_arg_functor<T>> : std::true_type { };
template<typename T> template<typename T>
struct is_rd_arg<add_arg_functor<T>> : std::true_type { }; struct is_rd_arg<add_arg_functor<T>> : std::true_type { };
typedef decltype(on<std::string>()) opt0_rvalue_builder; using opt0_rvalue_builder = decltype(on<std::string>());
template<bool HasShortOpt = true> template<bool HasShortOpt = true>
class opt1_rvalue_builder { class opt1_rvalue_builder {
public: public:
typedef decltype(on<std::string, std::string>()) left_type; using left_type = decltype(on<std::string, std::string>());
typedef decltype(on(std::function<optional<std::string>(const std::string&)>())) using right_type = decltype(on(std::function<optional<std::string>
right_type; (const std::string&)>()));
template<typename Left, typename Right> template<typename Left, typename Right>
opt1_rvalue_builder(char sopt, std::string lopt, Left&& lhs, Right&& rhs) opt1_rvalue_builder(char sopt, std::string lopt, Left&& lhs, Right&& rhs)
...@@ -190,8 +190,8 @@ class opt1_rvalue_builder<false> { ...@@ -190,8 +190,8 @@ class opt1_rvalue_builder<false> {
public: public:
typedef decltype(on(std::function<optional<std::string>(const std::string&)>())) using sub_type = decltype(on(std::function<optional<std::string>
sub_type; (const std::string&)>()));
template<typename SubType> template<typename SubType>
opt1_rvalue_builder(std::string lopt, SubType&& sub) opt1_rvalue_builder(std::string lopt, SubType&& sub)
......
...@@ -78,13 +78,13 @@ class producer_consumer_list { ...@@ -78,13 +78,13 @@ class producer_consumer_list {
public: public:
typedef T value_type; using value_type = T;
typedef size_t size_type; using size_type = size_t;
typedef ptrdiff_t difference_type; using difference_type = ptrdiff_t;
typedef value_type& reference; using reference = value_type&;
typedef const value_type& const_reference; using const_reference = const value_type&;
typedef value_type* pointer; using pointer = value_type*;
typedef const value_type* const_pointer; using const_pointer = const value_type*;
class node { class node {
......
...@@ -21,8 +21,8 @@ template<class Base, class Derived, class Policies> ...@@ -21,8 +21,8 @@ template<class Base, class Derived, class Policies>
class proper_actor_base class proper_actor_base
: public Policies::resume_policy::template mixin<Base, Derived> { : public Policies::resume_policy::template mixin<Base, Derived> {
typedef typename Policies::resume_policy::template mixin<Base, Derived> using super = typename Policies::resume_policy::template mixin<Base,
super; Derived>;
public: public:
...@@ -36,7 +36,7 @@ class proper_actor_base ...@@ -36,7 +36,7 @@ class proper_actor_base
// member functions from scheduling policy // member functions from scheduling policy
typedef typename Policies::scheduling_policy::timeout_type timeout_type; using timeout_type = typename Policies::scheduling_policy::timeout_type;
void enqueue(const actor_addr& sender, void enqueue(const actor_addr& sender,
message_id mid, message_id mid,
...@@ -84,7 +84,7 @@ class proper_actor_base ...@@ -84,7 +84,7 @@ class proper_actor_base
priority_policy().push_to_cache(std::move(ptr)); priority_policy().push_to_cache(std::move(ptr));
} }
typedef typename Policies::priority_policy::cache_iterator cache_iterator; using cache_iterator = typename Policies::priority_policy::cache_iterator;
inline bool cache_empty() { inline bool cache_empty() {
return priority_policy().cache_empty(); return priority_policy().cache_empty();
...@@ -178,7 +178,7 @@ class proper_actor ...@@ -178,7 +178,7 @@ class proper_actor
: public proper_actor_base<Base, proper_actor<Base, Policies, false>, : public proper_actor_base<Base, proper_actor<Base, Policies, false>,
Policies> { Policies> {
typedef proper_actor_base<Base, proper_actor, Policies> super; using super = proper_actor_base<Base, proper_actor, Policies>;
public: public:
...@@ -230,7 +230,7 @@ class proper_actor< ...@@ -230,7 +230,7 @@ class proper_actor<
true> : public proper_actor_base<Base, proper_actor<Base, Policies, true>, true> : public proper_actor_base<Base, proper_actor<Base, Policies, true>,
Policies> { Policies> {
typedef proper_actor_base<Base, proper_actor, Policies> super; using super = proper_actor_base<Base, proper_actor, Policies>;
public: public:
......
...@@ -29,8 +29,8 @@ namespace detail { ...@@ -29,8 +29,8 @@ namespace detail {
// tuple-like access to an array of void pointers // tuple-like access to an array of void pointers
template<typename... T> template<typename... T>
struct pseudo_tuple { struct pseudo_tuple {
typedef void* pointer; using pointer = void*;
typedef const void* const_pointer; using const_pointer = const void*;
pointer data[sizeof...(T) > 0 ? sizeof...(T) : 1]; pointer data[sizeof...(T) > 0 ? sizeof...(T) : 1];
......
...@@ -28,19 +28,19 @@ namespace detail { ...@@ -28,19 +28,19 @@ namespace detail {
template<typename T> template<typename T>
struct purge_refs_impl { struct purge_refs_impl {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct purge_refs_impl<std::reference_wrapper<T>> { struct purge_refs_impl<std::reference_wrapper<T>> {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct purge_refs_impl<std::reference_wrapper<const T>> { struct purge_refs_impl<std::reference_wrapper<const T>> {
typedef T type; using type = T;
}; };
...@@ -49,8 +49,8 @@ struct purge_refs_impl<std::reference_wrapper<const T>> { ...@@ -49,8 +49,8 @@ struct purge_refs_impl<std::reference_wrapper<const T>> {
*/ */
template<typename T> template<typename T>
struct purge_refs { struct purge_refs {
typedef typename purge_refs_impl< using type = typename purge_refs_impl<
typename detail::rm_const_and_ref<T>::type>::type type; typename detail::rm_const_and_ref<T>::type>::type;
}; };
......
...@@ -52,7 +52,7 @@ typename std::enable_if< std::is_floating_point<T>::value ...@@ -52,7 +52,7 @@ typename std::enable_if< std::is_floating_point<T>::value
bool bool
>::type >::type
safe_equal(const T& lhs, const U& rhs) { safe_equal(const T& lhs, const U& rhs) {
typedef decltype(lhs - rhs) res_type; using res_type = decltype(lhs - rhs);
return std::fabs(lhs - rhs) <= std::numeric_limits<res_type>::epsilon(); return std::fabs(lhs - rhs) <= std::numeric_limits<res_type>::epsilon();
} }
......
...@@ -65,8 +65,8 @@ class single_reader_queue { ...@@ -65,8 +65,8 @@ class single_reader_queue {
public: public:
typedef T value_type; using value_type = T;
typedef value_type* pointer; using pointer = value_type*;
/** /**
* @warning call only from the reader (owner) * @warning call only from the reader (owner)
......
...@@ -29,8 +29,8 @@ namespace cppa { ...@@ -29,8 +29,8 @@ namespace cppa {
namespace detail { namespace detail {
struct tuple_dummy { struct tuple_dummy {
typedef detail::empty_type_list types; using types = detail::empty_type_list;
typedef message_iterator<tuple_dummy> const_iterator; using const_iterator = message_iterator<tuple_dummy>;
inline size_t size() const { return 0; } inline size_t size() const { return 0; }
inline void* mutable_at(size_t) { return nullptr; } inline void* mutable_at(size_t) { return nullptr; }
inline const void* at(size_t) const { return nullptr; } inline const void* at(size_t) const { return nullptr; }
......
...@@ -57,13 +57,13 @@ class tuple_vals : public message_data { ...@@ -57,13 +57,13 @@ class tuple_vals : public message_data {
static_assert(sizeof...(Ts) > 0, "tuple_vals is not allowed to be empty"); static_assert(sizeof...(Ts) > 0, "tuple_vals is not allowed to be empty");
typedef message_data super; using super = message_data;
public: public:
typedef std::tuple<Ts...> data_type; using data_type = std::tuple<Ts...>;
typedef types_array<Ts...> element_types; using element_types = types_array<Ts...>;
tuple_vals(const tuple_vals&) = default; tuple_vals(const tuple_vals&) = default;
......
...@@ -27,14 +27,6 @@ ...@@ -27,14 +27,6 @@
#include "cppa/detail/tbind.hpp" #include "cppa/detail/tbind.hpp"
#include "cppa/detail/type_pair.hpp" #include "cppa/detail/type_pair.hpp"
namespace cppa {
// forward declarations
class uniform_type_info;
const uniform_type_info* uniform_typeid(const std::type_info&);
} // namespace cppa
namespace cppa { namespace cppa {
namespace detail { namespace detail {
...@@ -47,23 +39,21 @@ namespace detail { ...@@ -47,23 +39,21 @@ namespace detail {
* @brief A list of types. * @brief A list of types.
*/ */
template<typename... Ts> template<typename... Ts>
struct type_list {}; struct type_list { };
/** /**
* @brief Denotes the empty list. * @brief Denotes the empty list.
*/ */
typedef type_list<> empty_type_list; using empty_type_list = type_list<>;
template<typename T> template<typename T>
struct is_type_list { struct is_type_list {
static constexpr bool value = false; static constexpr bool value = false;
}; };
template<typename... Ts> template<typename... Ts>
struct is_type_list<type_list<Ts...>> { struct is_type_list<type_list<Ts...>> {
static constexpr bool value = true; static constexpr bool value = true;
}; };
// T head(type_list) // T head(type_list)
...@@ -76,14 +66,12 @@ struct tl_head; ...@@ -76,14 +66,12 @@ struct tl_head;
template<template<typename...> class List> template<template<typename...> class List>
struct tl_head<List<>> { struct tl_head<List<>> {
typedef void type; using type = void;
}; };
template<template<typename...> class List, typename T0, typename... Ts> template<template<typename...> class List, typename T0, typename... Ts>
struct tl_head<List<T0, Ts...>> { struct tl_head<List<T0, Ts...>> {
typedef T0 type; using type = T0;
}; };
// type_list tail(type_list) // type_list tail(type_list)
...@@ -96,14 +84,12 @@ struct tl_tail; ...@@ -96,14 +84,12 @@ struct tl_tail;
template<template<typename...> class List> template<template<typename...> class List>
struct tl_tail<List<>> { struct tl_tail<List<>> {
typedef List<> type; using type = List<>;
}; };
template<template<typename...> class List, typename T0, typename... Ts> template<template<typename...> class List, typename T0, typename... Ts>
struct tl_tail<List<T0, Ts...>> { struct tl_tail<List<T0, Ts...>> {
typedef List<Ts...> type; using type = List<Ts...>;
}; };
// size_t size(type_list) // size_t size(type_list)
...@@ -117,7 +103,6 @@ struct tl_size; ...@@ -117,7 +103,6 @@ struct tl_size;
template<template<typename...> class List, typename... Ts> template<template<typename...> class List, typename... Ts>
struct tl_size<List<Ts...>> { struct tl_size<List<Ts...>> {
static constexpr size_t value = sizeof...(Ts); static constexpr size_t value = sizeof...(Ts);
}; };
// T back(type_list) // T back(type_list)
...@@ -130,23 +115,22 @@ struct tl_back; ...@@ -130,23 +115,22 @@ struct tl_back;
template<template<typename...> class List> template<template<typename...> class List>
struct tl_back<List<>> { struct tl_back<List<>> {
typedef unit_t type; using type = unit_t;
}; };
template<template<typename...> class List, typename T0> template<template<typename...> class List, typename T0>
struct tl_back<List<T0>> { struct tl_back<List<T0>> {
typedef T0 type; using type = T0;
}; };
template<template<typename...> class List, typename T0, typename T1, template<template<typename...> class List,
typename T0,
typename T1,
typename... Ts> typename... Ts>
struct tl_back<List<T0, T1, Ts...>> { struct tl_back<List<T0, T1, Ts...>> {
// remaining arguments are forwarded as type_list to prevent // remaining arguments are forwarded as type_list to prevent
// recursive instantiation of List class // recursive instantiation of List class
typedef typename tl_back<type_list<T1, Ts...>>::type type; using type = typename tl_back<type_list<T1, Ts...>>::type;
}; };
// bool empty(type_list) // bool empty(type_list)
...@@ -157,59 +141,73 @@ struct tl_back<List<T0, T1, Ts...>> { ...@@ -157,59 +141,73 @@ struct tl_back<List<T0, T1, Ts...>> {
template<class List> template<class List>
struct tl_empty { struct tl_empty {
static constexpr bool value = std::is_same<empty_type_list, List>::value; static constexpr bool value = std::is_same<empty_type_list, List>::value;
}; };
// list slice(size_t, size_t) // list slice(size_t, size_t)
template<size_t LeftOffset, size_t Remaining, typename PadType, class List, template<size_t LeftOffset,
size_t Remaining,
typename PadType,
class List,
typename... T> typename... T>
struct tl_slice_impl { struct tl_slice_impl {
typedef typename tl_slice_impl<LeftOffset - 1, Remaining, PadType, using type = typename tl_slice_impl<
LeftOffset - 1,
Remaining,
PadType,
typename tl_tail<List>::type, typename tl_tail<List>::type,
T...>::type type; T...
>::type;
}; };
template<size_t Remaining, typename PadType, class List, typename... T> template<size_t Remaining, typename PadType, class List, typename... T>
struct tl_slice_impl<0, Remaining, PadType, List, T...> { struct tl_slice_impl<0, Remaining, PadType, List, T...> {
typedef typename tl_slice_impl<0, Remaining - 1, PadType, using type = typename tl_slice_impl<
typename tl_tail<List>::type, T..., 0,
typename tl_head<List>::type>::type type; Remaining - 1,
PadType,
typename tl_tail<List>::type,
T...,
typename tl_head<List>::type
>::type;
}; };
template<size_t Remaining, typename PadType, typename... T> template<size_t Remaining, typename PadType, typename... T>
struct tl_slice_impl<0, Remaining, PadType, empty_type_list, T...> { struct tl_slice_impl<0, Remaining, PadType, empty_type_list, T...> {
typedef typename tl_slice_impl<0, Remaining - 1, PadType, empty_type_list, using type = typename tl_slice_impl<
T..., PadType>::type type; 0,
Remaining - 1,
PadType,
empty_type_list,
T...,
PadType
>::type;
}; };
template<typename PadType, class List, typename... T> template<typename PadType, class List, typename... T>
struct tl_slice_impl<0, 0, PadType, List, T...> { struct tl_slice_impl<0, 0, PadType, List, T...> {
typedef type_list<T...> type; using type = type_list<T...>;
}; };
template<typename PadType, typename... T> template<typename PadType, typename... T>
struct tl_slice_impl<0, 0, PadType, empty_type_list, T...> { struct tl_slice_impl<0, 0, PadType, empty_type_list, T...> {
typedef type_list<T...> type; using type = type_list<T...>;
}; };
template<class List, size_t ListSize, size_t First, size_t Last, template<class List, size_t ListSize, size_t First, size_t Last,
typename PadType = unit_t> typename PadType = unit_t>
struct tl_slice_ { struct tl_slice_ {
typedef typename tl_slice_impl<First, (Last - First), PadType, List>::type using type = typename tl_slice_impl<
type; First,
(Last - First),
PadType,
List
>::type;
}; };
template<class List, size_t ListSize, typename PadType> template<class List, size_t ListSize, typename PadType>
struct tl_slice_<List, ListSize, 0, ListSize, PadType> { struct tl_slice_<List, ListSize, 0, ListSize, PadType> {
typedef List type; using type = List;
}; };
/** /**
...@@ -217,9 +215,12 @@ struct tl_slice_<List, ListSize, 0, ListSize, PadType> { ...@@ -217,9 +215,12 @@ struct tl_slice_<List, ListSize, 0, ListSize, PadType> {
*/ */
template<class List, size_t First, size_t Last> template<class List, size_t First, size_t Last>
struct tl_slice { struct tl_slice {
typedef typename tl_slice_<List, tl_size<List>::value, using type = typename tl_slice_<
(First > Last ? Last : First), Last>::type type; List,
tl_size<List>::value,
(First > Last ? Last : First),
Last
>::type;
}; };
/** /**
...@@ -229,16 +230,18 @@ struct tl_slice { ...@@ -229,16 +230,18 @@ struct tl_slice {
* e.g., tl_zip<type_list<int, double>, type_list<float, string>>::type * e.g., tl_zip<type_list<int, double>, type_list<float, string>>::type
* is type_list<type_pair<int, float>, type_pair<double, string>>. * is type_list<type_pair<int, float>, type_pair<double, string>>.
*/ */
template<class ListA, class ListB, template<class ListA,
class ListB,
template<typename, typename> class Fun = to_type_pair> template<typename, typename> class Fun = to_type_pair>
struct tl_zip_impl; struct tl_zip_impl;
template<typename... LhsElements, typename... RhsElements, template<typename... LhsElements,
typename... RhsElements,
template<typename, typename> class Fun> template<typename, typename> class Fun>
struct tl_zip_impl<type_list<LhsElements...>, type_list<RhsElements...>, Fun> { struct tl_zip_impl<type_list<LhsElements...>, type_list<RhsElements...>, Fun> {
static_assert(sizeof...(LhsElements) == sizeof...(RhsElements), static_assert(sizeof...(LhsElements) == sizeof...(RhsElements),
"Lists have different size"); "Lists have different size");
typedef type_list<typename Fun<LhsElements, RhsElements>::type...> type; using type = type_list<typename Fun<LhsElements, RhsElements>::type...>;
}; };
...@@ -250,25 +253,40 @@ struct tl_zip { ...@@ -250,25 +253,40 @@ struct tl_zip {
static constexpr size_t result_size = (sizea < sizeb) ? sizea : sizeb; static constexpr size_t result_size = (sizea < sizeb) ? sizea : sizeb;
typedef typename tl_zip_impl<typename tl_slice<ListA, 0, result_size>::type, using type = typename tl_zip_impl<
typename tl_slice<ListA, 0, result_size>::type,
typename tl_slice<ListB, 0, result_size>::type, typename tl_slice<ListB, 0, result_size>::type,
Fun>::type type; Fun
>::type;
}; };
template<class ListA, class ListB, typename PadA = unit_t, template<class ListA,
class ListB,
typename PadA = unit_t,
typename PadB = unit_t, typename PadB = unit_t,
template<typename, typename> class Fun = to_type_pair> template<typename, typename> class Fun = to_type_pair>
struct tl_zip_all { struct tl_zip_all {
static constexpr size_t result_size =
(tl_size<ListA>::value > tl_size<ListB>::value) ?
tl_size<ListA>::value :
tl_size<ListB>::value;
typedef typename tl_zip_impl< static constexpr size_t result_size =
typename tl_slice_<ListA, tl_size<ListA>::value, 0, result_size>::type, (tl_size<ListA>::value > tl_size<ListB>::value) ? tl_size<ListA>::value
typename tl_slice_<ListB, tl_size<ListB>::value, 0, result_size>::type, : tl_size<ListB>::value;
Fun>::type type;
using type = typename tl_zip_impl<
typename tl_slice_<
ListA,
tl_size<ListA>::value,
0,
result_size
>::type,
typename tl_slice_<
ListB,
tl_size<ListB>::value,
0,
result_size
>::type,
Fun
>::type;
}; };
...@@ -277,39 +295,8 @@ struct tl_unzip; ...@@ -277,39 +295,8 @@ struct tl_unzip;
template<typename... Elements> template<typename... Elements>
struct tl_unzip<type_list<Elements...>> { struct tl_unzip<type_list<Elements...>> {
typedef type_list<typename Elements::first...> first; using first = type_list<typename Elements::first...>;
typedef type_list<typename Elements::second...> second; using second = type_list<typename Elements::second...>;
};
// static list zip_with_index(list)
template<bool Done, class List, size_t Pos, size_t...>
struct tl_zip_with_index_impl;
template<class List, size_t Pos, size_t... Range>
struct tl_zip_with_index_impl<
false, List, Pos,
Range...> : tl_zip_with_index_impl<tl_size<List>::value == (Pos + 1), List,
(Pos + 1), Range..., Pos> {};
template<typename... Ts, size_t Pos, size_t... Range>
struct tl_zip_with_index_impl<true, type_list<Ts...>, Pos, Range...> {
typedef type_list<type_pair<std::integral_constant<size_t, Range>, Ts>...>
type;
};
template<class List>
struct tl_zip_with_index {
typedef typename tl_zip_with_index_impl<false, List, 0>::type type;
};
template<>
struct tl_zip_with_index<empty_type_list> {
typedef empty_type_list type;
}; };
// int index_of(list, type) // int index_of(list, type)
...@@ -318,14 +305,12 @@ template<class List, typename T> ...@@ -318,14 +305,12 @@ template<class List, typename T>
struct tl_index_of { struct tl_index_of {
static constexpr size_t value = static constexpr size_t value =
tl_index_of<typename tl_tail<List>::type, T>::value; tl_index_of<typename tl_tail<List>::type, T>::value;
}; };
template<size_t N, typename T, typename... Ts> template<size_t N, typename T, typename... Ts>
struct tl_index_of< struct tl_index_of<
type_list<type_pair<std::integral_constant<size_t, N>, T>, Ts...>, T> { type_list<type_pair<std::integral_constant<size_t, N>, T>, Ts...>, T> {
static constexpr size_t value = N; static constexpr size_t value = N;
}; };
// list reverse() // list reverse()
...@@ -335,14 +320,12 @@ struct tl_reverse_impl; ...@@ -335,14 +320,12 @@ struct tl_reverse_impl;
template<typename T0, typename... T, typename... E> template<typename T0, typename... T, typename... E>
struct tl_reverse_impl<type_list<T0, T...>, E...> { struct tl_reverse_impl<type_list<T0, T...>, E...> {
typedef typename tl_reverse_impl<type_list<T...>, T0, E...>::type type; using type = typename tl_reverse_impl<type_list<T...>, T0, E...>::type;
}; };
template<typename... E> template<typename... E>
struct tl_reverse_impl<empty_type_list, E...> { struct tl_reverse_impl<empty_type_list, E...> {
typedef type_list<E...> type; using type = type_list<E...>;
}; };
/** /**
...@@ -350,8 +333,7 @@ struct tl_reverse_impl<empty_type_list, E...> { ...@@ -350,8 +333,7 @@ struct tl_reverse_impl<empty_type_list, E...> {
*/ */
template<class List> template<class List>
struct tl_reverse { struct tl_reverse {
typedef typename tl_reverse_impl<List>::type type; using type = typename tl_reverse_impl<List>::type;
}; };
// bool find(list, type) // bool find(list, type)
...@@ -512,26 +494,6 @@ struct tl_count_not<empty_type_list, Predicate> { ...@@ -512,26 +494,6 @@ struct tl_count_not<empty_type_list, Predicate> {
}; };
// bool zipped_forall(predicate)
/**
* @brief Tests whether a predicate holds for all elements of a zipped list.
*/
template<class List, template<typename, typename> class Predicate>
struct tl_zipped_forall {
typedef typename tl_head<List>::type head;
static constexpr bool value =
Predicate<typename head::first, typename head::second>::value &&
tl_zipped_forall<typename tl_tail<List>::type, Predicate>::value;
};
template<template<typename, typename> class Predicate>
struct tl_zipped_forall<empty_type_list, Predicate> {
static constexpr bool value = true;
};
template<class ListA, class ListB> template<class ListA, class ListB>
struct tl_concat_impl; struct tl_concat_impl;
...@@ -540,7 +502,7 @@ struct tl_concat_impl; ...@@ -540,7 +502,7 @@ struct tl_concat_impl;
*/ */
template<typename... LhsTs, typename... RhsTs> template<typename... LhsTs, typename... RhsTs>
struct tl_concat_impl<type_list<LhsTs...>, type_list<RhsTs...>> { struct tl_concat_impl<type_list<LhsTs...>, type_list<RhsTs...>> {
typedef type_list<LhsTs..., RhsTs...> type; using type = type_list<LhsTs..., RhsTs...>;
}; };
...@@ -554,14 +516,16 @@ struct tl_concat; ...@@ -554,14 +516,16 @@ struct tl_concat;
template<class List0> template<class List0>
struct tl_concat<List0> { struct tl_concat<List0> {
typedef List0 type; using type = List0;
}; };
template<class List0, class List1, class... Lists> template<class List0, class List1, class... Lists>
struct tl_concat<List0, List1, Lists...> { struct tl_concat<List0, List1, Lists...> {
typedef typename tl_concat<typename tl_concat_impl<List0, List1>::type, using type = typename tl_concat<
Lists...>::type type; typename tl_concat_impl<List0, List1>::type,
Lists...
>::type;
}; };
...@@ -575,7 +539,7 @@ struct tl_push_back; ...@@ -575,7 +539,7 @@ struct tl_push_back;
*/ */
template<typename... ListTs, typename What> template<typename... ListTs, typename What>
struct tl_push_back<type_list<ListTs...>, What> { struct tl_push_back<type_list<ListTs...>, What> {
typedef type_list<ListTs..., What> type; using type = type_list<ListTs..., What>;
}; };
...@@ -587,7 +551,7 @@ struct tl_push_front; ...@@ -587,7 +551,7 @@ struct tl_push_front;
*/ */
template<typename... ListTs, typename What> template<typename... ListTs, typename What>
struct tl_push_front<type_list<ListTs...>, What> { struct tl_push_front<type_list<ListTs...>, What> {
typedef type_list<What, ListTs...> type; using type = type_list<What, ListTs...>;
}; };
...@@ -598,14 +562,14 @@ struct tl_apply_all; ...@@ -598,14 +562,14 @@ struct tl_apply_all;
template<typename T> template<typename T>
struct tl_apply_all<T> { struct tl_apply_all<T> {
typedef T type; using type = T;
}; };
template<typename T, template<typename> class Fun0, template<typename T, template<typename> class Fun0,
template<typename> class... Funs> template<typename> class... Funs>
struct tl_apply_all<T, Fun0, Funs...> { struct tl_apply_all<T, Fun0, Funs...> {
typedef typename tl_apply_all<typename Fun0<T>::type, Funs...>::type type; using type = typename tl_apply_all<typename Fun0<T>::type, Funs...>::type;
}; };
...@@ -617,7 +581,7 @@ struct tl_map; ...@@ -617,7 +581,7 @@ struct tl_map;
template<typename... Ts, template<typename> class... Funs> template<typename... Ts, template<typename> class... Funs>
struct tl_map<type_list<Ts...>, Funs...> { struct tl_map<type_list<Ts...>, Funs...> {
typedef type_list<typename tl_apply_all<Ts, Funs...>::type...> type; using type = type_list<typename tl_apply_all<Ts, Funs...>::type...>;
}; };
...@@ -625,60 +589,33 @@ struct tl_map<type_list<Ts...>, Funs...> { ...@@ -625,60 +589,33 @@ struct tl_map<type_list<Ts...>, Funs...> {
* @brief Creates a new list by applying a @p Fun to each element which * @brief Creates a new list by applying a @p Fun to each element which
* returns @p TraitResult for @p Trait. * returns @p TraitResult for @p Trait.
*/ */
template<class List, template<typename> class Trait, bool TraitResult, template<class List, template<typename> class Trait, bool TRes,
template<typename> class... Funs> template<typename> class... Funs>
struct tl_map_conditional { struct tl_map_conditional {
typedef typename tl_concat< using type = typename tl_concat<
type_list<typename std::conditional< type_list<
Trait<typename tl_head<List>::type>::value == TraitResult, typename std::conditional<
typename tl_apply_all<typename tl_head<List>::type, Funs...>::type, Trait<typename tl_head<List>::type>::value == TRes,
typename tl_head<List>::type>::type>, typename tl_apply_all<
typename tl_map_conditional<typename tl_tail<List>::type, Trait, typename tl_head<List>::type,
TraitResult, Funs...>::type>::type type; Funs...
>::type,
typename tl_head<List>::type
>::type
>,
typename tl_map_conditional<
typename tl_tail<List>::type,
Trait,
TRes,
Funs...
>::type
>::type;
}; };
template<template<typename> class Trait, bool TraitResult, template<template<typename> class Trait, bool TraitResult,
template<typename> class... Funs> template<typename> class... Funs>
struct tl_map_conditional<empty_type_list, Trait, TraitResult, Funs...> { struct tl_map_conditional<empty_type_list, Trait, TraitResult, Funs...> {
typedef empty_type_list type; using type = empty_type_list;
};
/*
freaks GCC out ...
template<typename... Ts,
template<typename> class Trait,
bool TraitResult,
template<typename> class... Funs>
struct tl_map_conditional<type_list<Ts...>, Trait, TraitResult, Funs...> {
typedef type_list<
typename std::conditional<
Trait<Ts>::value == TraitResult,
typename tl_apply_all<Ts, Funs...>::type,
Ts
>::type
...
type;
};
*/
// list zipped_map(trait)
template<class List, template<typename, typename> class Fun>
struct tl_zipped_map;
/**
* @brief Creates a new list by applying a "binary template function"
* to each element.
*/
template<typename... T, template<typename, typename> class Fun>
struct tl_zipped_map<type_list<T...>, Fun> {
typedef type_list<
typename Fun<typename T::first, typename T::second>::type...> type;
}; };
...@@ -689,13 +626,13 @@ struct tl_zipped_map<type_list<T...>, Fun> { ...@@ -689,13 +626,13 @@ struct tl_zipped_map<type_list<T...>, Fun> {
*/ */
template<class List> template<class List>
struct tl_pop_back { struct tl_pop_back {
typedef typename tl_slice<List, 0, tl_size<List>::value - 1>::type type; using type = typename tl_slice<List, 0, tl_size<List>::value - 1>::type;
}; };
template<> template<>
struct tl_pop_back<empty_type_list> { struct tl_pop_back<empty_type_list> {
typedef empty_type_list type; using type = empty_type_list;
}; };
...@@ -706,19 +643,19 @@ struct tl_at_impl; ...@@ -706,19 +643,19 @@ struct tl_at_impl;
template<size_t N, typename E0, typename... E> template<size_t N, typename E0, typename... E>
struct tl_at_impl<N, E0, E...> { struct tl_at_impl<N, E0, E...> {
typedef typename tl_at_impl<N - 1, E...>::type type; using type = typename tl_at_impl<N - 1, E...>::type;
}; };
template<typename E0, typename... E> template<typename E0, typename... E>
struct tl_at_impl<0, E0, E...> { struct tl_at_impl<0, E0, E...> {
typedef E0 type; using type = E0;
}; };
template<size_t N> template<size_t N>
struct tl_at_impl<N> { struct tl_at_impl<N> {
typedef unit_t type; // no such element using type = unit_t; // no such element
}; };
...@@ -730,7 +667,7 @@ struct tl_at; ...@@ -730,7 +667,7 @@ struct tl_at;
*/ */
template<size_t N, typename... E> template<size_t N, typename... E>
struct tl_at<type_list<E...>, N> { struct tl_at<type_list<E...>, N> {
typedef typename tl_at_impl<N, E...>::type type; using type = typename tl_at_impl<N, E...>::type;
}; };
...@@ -744,7 +681,7 @@ struct tl_prepend; ...@@ -744,7 +681,7 @@ struct tl_prepend;
*/ */
template<typename What, typename... T> template<typename What, typename... T>
struct tl_prepend<type_list<T...>, What> { struct tl_prepend<type_list<T...>, What> {
typedef type_list<What, T...> type; using type = type_list<What, T...>;
}; };
...@@ -756,21 +693,25 @@ struct tl_filter_impl; ...@@ -756,21 +693,25 @@ struct tl_filter_impl;
template<> template<>
struct tl_filter_impl<empty_type_list> { struct tl_filter_impl<empty_type_list> {
typedef empty_type_list type; using type = empty_type_list;
}; };
template<typename T0, typename... T, bool... S> template<typename T0, typename... T, bool... S>
struct tl_filter_impl<type_list<T0, T...>, false, S...> { struct tl_filter_impl<type_list<T0, T...>, false, S...> {
typedef typename tl_filter_impl<type_list<T...>, S...>::type type; using type = typename tl_filter_impl<type_list<T...>, S...>::type;
}; };
template<typename T0, typename... T, bool... S> template<typename T0, typename... T, bool... S>
struct tl_filter_impl<type_list<T0, T...>, true, S...> { struct tl_filter_impl<type_list<T0, T...>, true, S...> {
typedef typename tl_prepend< using type = typename tl_prepend<
typename tl_filter_impl<type_list<T...>, S...>::type, T0>::type type; typename tl_filter_impl<
type_list<T...>,
S...
>::type,
T0
>::type;
}; };
template<class List, template<typename> class Predicate> template<class List, template<typename> class Predicate>
...@@ -781,9 +722,10 @@ struct tl_filter; ...@@ -781,9 +722,10 @@ struct tl_filter;
*/ */
template<template<typename> class Predicate, typename... T> template<template<typename> class Predicate, typename... T>
struct tl_filter<type_list<T...>, Predicate> { struct tl_filter<type_list<T...>, Predicate> {
typedef typename tl_filter_impl<type_list<T...>, using type = typename tl_filter_impl<
Predicate<T>::value...>::type type; type_list<T...>,
Predicate<T>::value...
>::type;
}; };
/** /**
...@@ -795,15 +737,15 @@ struct tl_filter_not; ...@@ -795,15 +737,15 @@ struct tl_filter_not;
template<template<typename> class Predicate> template<template<typename> class Predicate>
struct tl_filter_not<empty_type_list, Predicate> { struct tl_filter_not<empty_type_list, Predicate> {
typedef empty_type_list type; using type = empty_type_list;
}; };
template<template<typename> class Predicate, typename... T> template<template<typename> class Predicate, typename... T>
struct tl_filter_not<type_list<T...>, Predicate> { struct tl_filter_not<type_list<T...>, Predicate> {
typedef typename tl_filter_impl<type_list<T...>, using type = typename tl_filter_impl<
!Predicate<T>::value...>::type type; type_list<T...>,
!Predicate<T>::value...
>::type;
}; };
/** /**
...@@ -815,9 +757,10 @@ struct tl_filter_type; ...@@ -815,9 +757,10 @@ struct tl_filter_type;
template<class Type, typename... T> template<class Type, typename... T>
struct tl_filter_type<type_list<T...>, Type> { struct tl_filter_type<type_list<T...>, Type> {
typedef typename tl_filter_impl< using type = typename tl_filter_impl<
type_list<T...>, !std::is_same<T, Type>::value...>::type type; type_list<T...>,
!std::is_same<T, Type>::value...
>::type;
}; };
/** /**
...@@ -829,9 +772,10 @@ struct tl_filter_not_type; ...@@ -829,9 +772,10 @@ struct tl_filter_not_type;
template<class Type, typename... T> template<class Type, typename... T>
struct tl_filter_not_type<type_list<T...>, Type> { struct tl_filter_not_type<type_list<T...>, Type> {
typedef typename tl_filter_impl< using type = typename tl_filter_impl<
type_list<T...>, (!std::is_same<T, Type>::value)...>::type type; type_list<T...>,
(!std::is_same<T, Type>::value)...
>::type;
}; };
// list distinct(list) // list distinct(list)
...@@ -844,16 +788,20 @@ struct tl_distinct; ...@@ -844,16 +788,20 @@ struct tl_distinct;
template<> template<>
struct tl_distinct<empty_type_list> { struct tl_distinct<empty_type_list> {
typedef empty_type_list type; using type = empty_type_list;
}; };
template<typename T0, typename... Ts> template<typename T0, typename... Ts>
struct tl_distinct<type_list<T0, Ts...>> { struct tl_distinct<type_list<T0, Ts...>> {
typedef typename tl_concat< using type = typename tl_concat<
type_list<T0>, typename tl_distinct<typename tl_filter_type< type_list<T0>,
type_list<Ts...>, T0>::type>::type>::type type; typename tl_distinct<
typename tl_filter_type<
type_list<Ts...>,
T0
>::type
>::type
>::type;
}; };
// bool is_distinct // bool is_distinct
...@@ -865,7 +813,6 @@ template<class L> ...@@ -865,7 +813,6 @@ template<class L>
struct tl_is_distinct { struct tl_is_distinct {
static constexpr bool value = static constexpr bool value =
tl_size<L>::value == tl_size<typename tl_distinct<L>::type>::value; tl_size<L>::value == tl_size<typename tl_distinct<L>::type>::value;
}; };
/** /**
...@@ -875,14 +822,12 @@ template<class List, size_t N> ...@@ -875,14 +822,12 @@ template<class List, size_t N>
struct tl_right { struct tl_right {
static constexpr size_t list_size = tl_size<List>::value; static constexpr size_t list_size = tl_size<List>::value;
static constexpr size_t first_idx = (list_size > N) ? (list_size - N) : 0; static constexpr size_t first_idx = (list_size > N) ? (list_size - N) : 0;
typedef typename tl_slice<List, first_idx, list_size>::type type; using type = typename tl_slice<List, first_idx, list_size>::type;
}; };
template<size_t N> template<size_t N>
struct tl_right<empty_type_list, N> { struct tl_right<empty_type_list, N> {
typedef empty_type_list type; using type = empty_type_list;
}; };
// list resize(list, size, fill_type) // list resize(list, size, fill_type)
...@@ -893,22 +838,23 @@ struct tl_pad_right_impl; ...@@ -893,22 +838,23 @@ struct tl_pad_right_impl;
template<class List, size_t OldSize, size_t NewSize, typename FillType> template<class List, size_t OldSize, size_t NewSize, typename FillType>
struct tl_pad_right_impl<List, false, OldSize, NewSize, FillType> { struct tl_pad_right_impl<List, false, OldSize, NewSize, FillType> {
typedef typename tl_slice<List, 0, NewSize>::type type; using type = typename tl_slice<List, 0, NewSize>::type;
}; };
template<class List, size_t Size, typename FillType> template<class List, size_t Size, typename FillType>
struct tl_pad_right_impl<List, false, Size, Size, FillType> { struct tl_pad_right_impl<List, false, Size, Size, FillType> {
typedef List type; using type = List;
}; };
template<class List, size_t OldSize, size_t NewSize, typename FillType> template<class List, size_t OldSize, size_t NewSize, typename FillType>
struct tl_pad_right_impl<List, true, OldSize, NewSize, FillType> { struct tl_pad_right_impl<List, true, OldSize, NewSize, FillType> {
typedef typename tl_pad_right_impl < using type = typename tl_pad_right_impl<
typename tl_push_back<List, FillType>::type, typename tl_push_back<List, FillType>::type,
(OldSize + 1)<NewSize, OldSize + 1, NewSize, FillType>::type type; OldSize + 1 < NewSize,
OldSize + 1,
NewSize,
FillType
>::type;
}; };
/** /**
...@@ -917,25 +863,33 @@ struct tl_pad_right_impl<List, true, OldSize, NewSize, FillType> { ...@@ -917,25 +863,33 @@ struct tl_pad_right_impl<List, true, OldSize, NewSize, FillType> {
*/ */
template<class List, size_t NewSize, typename FillType = unit_t> template<class List, size_t NewSize, typename FillType = unit_t>
struct tl_pad_right { struct tl_pad_right {
typedef typename tl_pad_right_impl<List, (tl_size<List>::value < NewSize), using type = typename tl_pad_right_impl<
tl_size<List>::value, NewSize, List,
FillType>::type type; (tl_size<List>::value < NewSize),
tl_size<List>::value,
NewSize,
FillType
>::type;
}; };
// bool pad_left(list, N) // bool pad_left(list, N)
template<class List, size_t OldSize, size_t NewSize, typename FillType> template<class List, size_t OldSize, size_t NewSize, typename FillType>
struct tl_pad_left_impl { struct tl_pad_left_impl {
typedef typename tl_pad_left_impl< using type = typename tl_pad_left_impl<
typename tl_push_front<List, FillType>::type, OldSize + 1, NewSize, typename tl_push_front<
FillType>::type type; List,
FillType
>::type,
OldSize + 1,
NewSize,
FillType
>::type;
}; };
template<class List, size_t Size, typename FillType> template<class List, size_t Size, typename FillType>
struct tl_pad_left_impl<List, Size, Size, FillType> { struct tl_pad_left_impl<List, Size, Size, FillType> {
typedef List type; using type = List;
}; };
...@@ -946,10 +900,13 @@ struct tl_pad_left_impl<List, Size, Size, FillType> { ...@@ -946,10 +900,13 @@ struct tl_pad_left_impl<List, Size, Size, FillType> {
template<class List, size_t NewSize, typename FillType = unit_t> template<class List, size_t NewSize, typename FillType = unit_t>
struct tl_pad_left { struct tl_pad_left {
static constexpr size_t list_size = tl_size<List>::value; static constexpr size_t list_size = tl_size<List>::value;
// static_assert(NewSize >= tl_size<List>::value, "List too big"); using type = typename tl_pad_left_impl<
typedef typename tl_pad_left_impl < List, list_size, List,
(list_size > NewSize) ? list_size : NewSize, FillType > ::type type; list_size,
(list_size > NewSize) ? list_size
: NewSize,
FillType
>::type;
}; };
// bool is_zipped(list) // bool is_zipped(list)
...@@ -957,7 +914,6 @@ struct tl_pad_left { ...@@ -957,7 +914,6 @@ struct tl_pad_left {
template<class List> template<class List>
struct tl_is_zipped { struct tl_is_zipped {
static constexpr bool value = tl_forall<List, is_type_pair>::value; static constexpr bool value = tl_forall<List, is_type_pair>::value;
}; };
/** /**
...@@ -965,17 +921,19 @@ struct tl_is_zipped { ...@@ -965,17 +921,19 @@ struct tl_is_zipped {
*/ */
template<class List, typename What = unit_t> template<class List, typename What = unit_t>
struct tl_trim { struct tl_trim {
typedef typename std::conditional< using type = typename std::conditional<
std::is_same<typename tl_back<List>::type, What>::value, std::is_same<typename tl_back<List>::type, What>::value,
typename tl_trim<typename tl_pop_back<List>::type, What>::type, typename tl_trim<
List>::type type; typename tl_pop_back<List>::type,
What
>::type,
List
>::type;
}; };
template<typename What> template<typename What>
struct tl_trim<empty_type_list, What> { struct tl_trim<empty_type_list, What> {
typedef empty_type_list type; using type = empty_type_list;
}; };
// list group_by(list, predicate) // list group_by(list, predicate)
...@@ -985,50 +943,62 @@ struct tl_group_by_impl_step; ...@@ -985,50 +943,62 @@ struct tl_group_by_impl_step;
template<typename What, typename... Ts> template<typename What, typename... Ts>
struct tl_group_by_impl_step<true, What, type_list<Ts...>> { struct tl_group_by_impl_step<true, What, type_list<Ts...>> {
typedef type_list<type_list<Ts..., What>> type; using type = type_list<type_list<Ts..., What>>;
}; };
template<typename What, class List> template<typename What, class List>
struct tl_group_by_impl_step<false, What, List> { struct tl_group_by_impl_step<false, What, List> {
typedef type_list<List, type_list<What>> type; using type = type_list<List, type_list<What>>;
}; };
template<class In, class Out, template<typename, typename> class Predicate> template<class In, class Out, template<typename, typename> class Predicate>
struct tl_group_by_impl { struct tl_group_by_impl {
typedef typename tl_back<Out>::type last_group;
typedef typename tl_group_by_impl_step<
Predicate<typename tl_head<In>::type,
typename tl_back<last_group>::type>::value,
typename tl_head<In>::type, last_group>::type suffix;
typedef typename tl_pop_back<Out>::type prefix;
typedef typename tl_concat<prefix, suffix>::type new_out;
typedef typename tl_group_by_impl<typename tl_tail<In>::type, new_out, using last_group = typename tl_back<Out>::type;
Predicate>::type type;
using suffix = typename tl_group_by_impl_step<
Predicate<
typename tl_head<In>::type,
typename tl_back<last_group>::type
>::value,
typename tl_head<In>::type,
last_group
>::type;
using prefix = typename tl_pop_back<Out>::type;
using new_out = typename tl_concat<prefix, suffix>::type;
using type = typename tl_group_by_impl<
typename tl_tail<In>::type,
new_out,
Predicate
>::type;
}; };
template<template<typename, typename> class Predicate, typename T0, template<template<typename, typename> class Predicate, typename T0,
typename... Ts> typename... Ts>
struct tl_group_by_impl<type_list<T0, Ts...>, empty_type_list, Predicate> { struct tl_group_by_impl<type_list<T0, Ts...>, empty_type_list, Predicate> {
typedef typename tl_group_by_impl< using type = typename tl_group_by_impl<
type_list<Ts...>, type_list<type_list<T0>>, Predicate>::type type; type_list<Ts...>,
type_list<type_list<T0>>,
Predicate
>::type;
}; };
template<class Out, template<typename, typename> class Predicate> template<class Out, template<typename, typename> class Predicate>
struct tl_group_by_impl<empty_type_list, Out, Predicate> { struct tl_group_by_impl<empty_type_list, Out, Predicate> {
typedef Out type; using type = Out;
}; };
template<class List, template<typename, typename> class Predicate> template<class List, template<typename, typename> class Predicate>
struct tl_group_by { struct tl_group_by {
typedef typename tl_group_by_impl<List, empty_type_list, Predicate>::type using type = typename tl_group_by_impl<
type; List,
empty_type_list,
Predicate
>::type;
}; };
/** /**
...@@ -1039,7 +1009,7 @@ struct tl_apply; ...@@ -1039,7 +1009,7 @@ struct tl_apply;
template<typename... Ts, template<typename...> class VarArgTemplate> template<typename... Ts, template<typename...> class VarArgTemplate>
struct tl_apply<type_list<Ts...>, VarArgTemplate> { struct tl_apply<type_list<Ts...>, VarArgTemplate> {
typedef VarArgTemplate<Ts...> type; using type = VarArgTemplate<Ts...>;
}; };
...@@ -1049,9 +1019,10 @@ template<class ListB> ...@@ -1049,9 +1019,10 @@ template<class ListB>
struct tl_is_strict_subset_step { struct tl_is_strict_subset_step {
template<typename T> template<typename T>
struct inner { struct inner {
typedef std::integral_constant<bool, tl_find<ListB, T>::value != -1> using type = std::integral_constant<
type; bool,
tl_find<ListB, T>::value != -1
>;
}; };
}; };
...@@ -1061,12 +1032,16 @@ struct tl_is_strict_subset_step { ...@@ -1061,12 +1032,16 @@ struct tl_is_strict_subset_step {
template<class ListA, class ListB> template<class ListA, class ListB>
struct tl_is_strict_subset { struct tl_is_strict_subset {
static constexpr bool value = static constexpr bool value =
std::is_same<ListA, ListB>::value || std::is_same<ListA, ListB>::value
std::is_same< || std::is_same<
type_list<std::integral_constant<bool, true>>, type_list<std::integral_constant<bool, true>>,
typename tl_distinct<typename tl_map< typename tl_distinct<
ListA, tl_is_strict_subset_step<ListB>::template inner>::type>:: typename tl_map<
type>::value; ListA,
tl_is_strict_subset_step<ListB>::template inner
>::type
>::type
>::value;
}; };
......
...@@ -28,14 +28,14 @@ namespace detail { ...@@ -28,14 +28,14 @@ namespace detail {
*/ */
template<typename First, typename Second> template<typename First, typename Second>
struct type_pair { struct type_pair {
typedef First first; using first = First;
typedef Second second; using second = Second;
}; };
template<typename First, typename Second> template<typename First, typename Second>
struct to_type_pair { struct to_type_pair {
typedef type_pair<First, Second> type; using type = type_pair<First, Second>;
}; };
......
...@@ -42,25 +42,25 @@ namespace detail { ...@@ -42,25 +42,25 @@ namespace detail {
*/ */
template<typename T> template<typename T>
struct rm_const_and_ref { struct rm_const_and_ref {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct rm_const_and_ref<const T&> { struct rm_const_and_ref<const T&> {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct rm_const_and_ref<const T> { struct rm_const_and_ref<const T> {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct rm_const_and_ref<T&> { struct rm_const_and_ref<T&> {
typedef T type; using type = T;
}; };
...@@ -119,8 +119,8 @@ struct is_anything : std::is_same<T, anything> {}; ...@@ -119,8 +119,8 @@ struct is_anything : std::is_same<T, anything> {};
*/ */
template<typename T, typename U> template<typename T, typename U>
struct is_array_of { struct is_array_of {
typedef typename std::remove_all_extents<T>::type step1_type; using step1_type = typename std::remove_all_extents<T>::type;
typedef typename std::remove_cv<step1_type>::type step2_type; using step2_type = typename std::remove_cv<step1_type>::type;
static constexpr bool value = static constexpr bool value =
std::is_array<T>::value && std::is_same<step2_type, U>::value; std::is_array<T>::value && std::is_same<step2_type, U>::value;
...@@ -131,19 +131,19 @@ struct is_array_of { ...@@ -131,19 +131,19 @@ struct is_array_of {
*/ */
template<typename T0, typename T1> template<typename T0, typename T1>
struct deduce_ref_type { struct deduce_ref_type {
typedef typename detail::rm_const_and_ref<T1>::type type; using type = typename detail::rm_const_and_ref<T1>::type;
}; };
template<typename T0, typename T1> template<typename T0, typename T1>
struct deduce_ref_type<T0&, T1> { struct deduce_ref_type<T0&, T1> {
typedef typename detail::rm_const_and_ref<T1>::type& type; using type = typename detail::rm_const_and_ref<T1>::type&;
}; };
template<typename T0, typename T1> template<typename T0, typename T1>
struct deduce_ref_type<const T0&, T1> { struct deduce_ref_type<const T0&, T1> {
typedef const typename detail::rm_const_and_ref<T1>::type& type; using type = const typename detail::rm_const_and_ref<T1>::type&;
}; };
...@@ -209,16 +209,16 @@ class is_comparable { ...@@ -209,16 +209,16 @@ class is_comparable {
template<typename A, typename B> template<typename A, typename B>
static bool cmp_help_fun(const A* arg0, const B* arg1, static bool cmp_help_fun(const A* arg0, const B* arg1,
decltype(*arg0 == *arg1) * = nullptr) { decltype(*arg0 == *arg1)* = nullptr) {
return true; return true;
} }
template<typename A, typename B> template<typename A, typename B>
static void cmp_help_fun(const A*, const B*, void* = nullptr) {} static void cmp_help_fun(const A*, const B*, void* = nullptr) {}
typedef decltype(cmp_help_fun(static_cast<T1*>(nullptr), using result_type = decltype(cmp_help_fun(static_cast<T1*>(nullptr),
static_cast<T2*>(nullptr), static_cast<T2*>(nullptr),
static_cast<bool*>(nullptr))) result_type; static_cast<bool*>(nullptr)));
public: public:
...@@ -251,7 +251,7 @@ class is_forward_iterator { ...@@ -251,7 +251,7 @@ class is_forward_iterator {
static void sfinae_fun(void*) {} static void sfinae_fun(void*) {}
typedef decltype(sfinae_fun(static_cast<T*>(nullptr))) result_type; using result_type = decltype(sfinae_fun(static_cast<T*>(nullptr)));
public: public:
...@@ -283,7 +283,7 @@ class is_iterable { ...@@ -283,7 +283,7 @@ class is_iterable {
// SFNINAE default // SFNINAE default
static void sfinae_fun(const void*) {} static void sfinae_fun(const void*) {}
typedef decltype(sfinae_fun(static_cast<const T*>(nullptr))) result_type; using result_type = decltype(sfinae_fun(static_cast<const T*>(nullptr)));
public: public:
...@@ -318,13 +318,13 @@ struct is_mutable_ref { ...@@ -318,13 +318,13 @@ struct is_mutable_ref {
*/ */
template<typename T> template<typename T>
struct rm_optional { struct rm_optional {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct rm_optional<optional<T>> { struct rm_optional<optional<T>> {
typedef T type; using type = T;
}; };
...@@ -343,50 +343,50 @@ struct callable_trait; ...@@ -343,50 +343,50 @@ struct callable_trait;
// member const function pointer // member const function pointer
template<class C, typename Result, typename... Ts> template<class C, typename Result, typename... Ts>
struct callable_trait<Result (C::*)(Ts...) const> { struct callable_trait<Result (C::*)(Ts...) const> {
typedef Result result_type; using result_type = Result;
typedef type_list<Ts...> arg_types; using arg_types = type_list<Ts...>;
typedef std::function<Result(Ts...)> fun_type; using fun_type = std::function<Result(Ts...)>;
}; };
// member function pointer // member function pointer
template<class C, typename Result, typename... Ts> template<class C, typename Result, typename... Ts>
struct callable_trait<Result (C::*)(Ts...)> { struct callable_trait<Result (C::*)(Ts...)> {
typedef Result result_type; using result_type = Result;
typedef type_list<Ts...> arg_types; using arg_types = type_list<Ts...>;
typedef std::function<Result(Ts...)> fun_type; using fun_type = std::function<Result(Ts...)>;
}; };
// good ol' function // good ol' function
template<typename Result, typename... Ts> template<typename Result, typename... Ts>
struct callable_trait<Result(Ts...)> { struct callable_trait<Result(Ts...)> {
typedef Result result_type; using result_type = Result;
typedef type_list<Ts...> arg_types; using arg_types = type_list<Ts...>;
typedef std::function<Result(Ts...)> fun_type; using fun_type = std::function<Result(Ts...)>;
}; };
// good ol' function pointer // good ol' function pointer
template<typename Result, typename... Ts> template<typename Result, typename... Ts>
struct callable_trait<Result (*)(Ts...)> { struct callable_trait<Result (*)(Ts...)> {
typedef Result result_type; using result_type = Result;
typedef type_list<Ts...> arg_types; using arg_types = type_list<Ts...>;
typedef std::function<Result(Ts...)> fun_type; using fun_type = std::function<Result(Ts...)>;
}; };
// matches (IsFun || IsMemberFun) // matches (IsFun || IsMemberFun)
template<bool IsFun, bool IsMemberFun, typename T> template<bool IsFun, bool IsMemberFun, typename T>
struct get_callable_trait_helper { struct get_callable_trait_helper {
typedef callable_trait<T> type; using type = callable_trait<T>;
}; };
// assume functor providing operator() // assume functor providing operator()
template<typename C> template<typename C>
struct get_callable_trait_helper<false, false, C> { struct get_callable_trait_helper<false, false, C> {
typedef callable_trait<decltype(&C::operator())> type; using type = callable_trait<decltype(&C::operator())>;
}; };
...@@ -398,18 +398,18 @@ struct get_callable_trait_helper<false, false, C> { ...@@ -398,18 +398,18 @@ struct get_callable_trait_helper<false, false, C> {
template<typename T> template<typename T>
struct get_callable_trait { struct get_callable_trait {
// type without cv qualifiers // type without cv qualifiers
typedef typename rm_const_and_ref<T>::type bare_type; using bare_type = typename rm_const_and_ref<T>::type;
// if type is a function pointer, this typedef identifies the function // if T is a function pointer, this type identifies the function
typedef typename std::remove_pointer<bare_type>::type signature_type; using signature_type = typename std::remove_pointer<bare_type>::type;
typedef typename get_callable_trait_helper < using type = typename get_callable_trait_helper<
std::is_function<bare_type>::value || std::is_function<bare_type>::value
std::is_function<signature_type>::value, || std::is_function<signature_type>::value,
std::is_member_function_pointer<bare_type>::value, std::is_member_function_pointer<bare_type>::value,
bare_type > ::type type; bare_type
typedef typename type::result_type result_type; >::type;
typedef typename type::arg_types arg_types; using result_type = typename type::result_type;
typedef typename type::fun_type fun_type; using arg_types = typename type::arg_types;
using fun_type = typename type::fun_type;
}; };
/** /**
...@@ -425,15 +425,16 @@ struct is_callable { ...@@ -425,15 +425,16 @@ struct is_callable {
template<typename C> template<typename C>
static bool static bool
_fun(C*, typename callable_trait<decltype(&C::operator())>::result_type* = _fun(C*,
nullptr) { typename callable_trait<decltype(&C::operator())>::result_type* = 0) {
return true; return true;
} }
static void _fun(void*) {} static void _fun(void*) { }
using pointer = typename rm_const_and_ref<T>::type*;
typedef decltype(_fun( using result_type = decltype(_fun(static_cast<pointer>(nullptr)));
static_cast<typename rm_const_and_ref<T>::type*>(nullptr))) result_type;
public: public:
...@@ -465,14 +466,14 @@ struct is_manipulator { ...@@ -465,14 +466,14 @@ struct is_manipulator {
template<bool IsCallable, typename C> template<bool IsCallable, typename C>
struct map_to_result_type_impl { struct map_to_result_type_impl {
typedef typename get_callable_trait<C>::type trait_type; using trait_type = typename get_callable_trait<C>::type;
typedef typename trait_type::result_type type; using type = typename trait_type::result_type;
}; };
template<typename C> template<typename C>
struct map_to_result_type_impl<false, C> { struct map_to_result_type_impl<false, C> {
typedef unit_t type; using type = unit_t;
}; };
...@@ -482,21 +483,20 @@ struct map_to_result_type_impl<false, C> { ...@@ -482,21 +483,20 @@ struct map_to_result_type_impl<false, C> {
*/ */
template<typename T> template<typename T>
struct map_to_result_type { struct map_to_result_type {
typedef typename map_to_result_type_impl<is_callable<T>::value, T>::type using type = typename map_to_result_type_impl<
type; is_callable<T>::value,
T
>::type;
}; };
template<bool DoReplace, typename T1, typename T2> template<bool DoReplace, typename T1, typename T2>
struct replace_type_impl { struct replace_type_impl {
typedef T1 type; using type = T1;
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct replace_type_impl<true, T1, T2> { struct replace_type_impl<true, T1, T2> {
typedef T2 type; using type = T2;
}; };
/** /**
...@@ -505,8 +505,7 @@ struct replace_type_impl<true, T1, T2> { ...@@ -505,8 +505,7 @@ struct replace_type_impl<true, T1, T2> {
template<typename What, typename With, typename... IfStmt> template<typename What, typename With, typename... IfStmt>
struct replace_type { struct replace_type {
static constexpr bool do_replace = disjunction<IfStmt::value...>::value; static constexpr bool do_replace = disjunction<IfStmt::value...>::value;
typedef typename replace_type_impl<do_replace, What, With>::type type; using type = typename replace_type_impl<do_replace, What, With>::type;
}; };
/** /**
...@@ -517,14 +516,12 @@ struct type_at; ...@@ -517,14 +516,12 @@ struct type_at;
template<size_t N, typename T0, typename... Ts> template<size_t N, typename T0, typename... Ts>
struct type_at<N, T0, Ts...> { struct type_at<N, T0, Ts...> {
typedef typename type_at<N - 1, Ts...>::type type; using type = typename type_at<N - 1, Ts...>::type;
}; };
template<typename T0, typename... Ts> template<typename T0, typename... Ts>
struct type_at<0, T0, Ts...> { struct type_at<0, T0, Ts...> {
typedef T0 type; using type = T0;
}; };
/** /**
......
...@@ -39,24 +39,30 @@ template<typename R, typename T> ...@@ -39,24 +39,30 @@ template<typename R, typename T>
struct deduce_signature_helper; struct deduce_signature_helper;
template<typename R, typename... Ts> template<typename R, typename... Ts>
struct deduce_signature_helper<R, detail::type_list<Ts...>> { struct deduce_signature_helper<R, type_list<Ts...>> {
typedef typename replies_to<Ts...>::template with<R> type; using type = typename replies_to<Ts...>::template with<R>;
}; };
template<typename... Rs, typename... Ts> template<typename... Rs, typename... Ts>
struct deduce_signature_helper<std::tuple<Rs...>, detail::type_list<Ts...>> { struct deduce_signature_helper<std::tuple<Rs...>, type_list<Ts...>> {
typedef typename replies_to<Ts...>::template with<Rs...> type; using type = typename replies_to<Ts...>::template with<Rs...>;
}; };
template<typename T> template<typename T>
struct deduce_signature { struct deduce_signature {
typedef typename detail::implicit_conversions<typename T::result_type>::type
result_type; using result_type = typename implicit_conversions<
typedef typename detail::tl_map<typename T::arg_types, typename T::result_type
detail::rm_const_and_ref>::type arg_types; >::type;
typedef typename deduce_signature_helper<result_type, arg_types>::type type;
using arg_types = typename tl_map<
typename T::arg_types,
rm_const_and_ref
>::type;
using type = typename deduce_signature_helper<result_type, arg_types>::type;
}; };
...@@ -72,50 +78,58 @@ struct input_is { ...@@ -72,50 +78,58 @@ struct input_is {
template<typename OutputList, typename F> template<typename OutputList, typename F>
inline void assert_types() { inline void assert_types() {
typedef typename detail::tl_map<
typename detail::get_callable_trait<F>::arg_types, using arg_types = typename tl_map<
detail::rm_const_and_ref>::type arg_types; typename get_callable_trait<F>::arg_types,
static constexpr size_t fun_args = detail::tl_size<arg_types>::value; rm_const_and_ref
static_assert(fun_args <= detail::tl_size<OutputList>::value, >::type;
static constexpr size_t fun_args = tl_size<arg_types>::value;
static_assert(fun_args <= tl_size<OutputList>::value,
"functor takes too much arguments"); "functor takes too much arguments");
typedef typename detail::tl_right<OutputList, fun_args>::type recv_types;
using recv_types = typename tl_right<OutputList, fun_args>::type;
static_assert(std::is_same<arg_types, recv_types>::value, static_assert(std::is_same<arg_types, recv_types>::value,
"wrong functor signature"); "wrong functor signature");
} }
template<typename T> template<typename T>
struct lifted_result_type { struct lifted_result_type {
typedef detail::type_list<typename detail::implicit_conversions<T>::type> using type = type_list<typename implicit_conversions<T>::type>;
type;
}; };
template<typename... Ts> template<typename... Ts>
struct lifted_result_type<std::tuple<Ts...>> { struct lifted_result_type<std::tuple<Ts...>> {
typedef detail::type_list<Ts...> type; using type = type_list<Ts...>;
}; };
template<typename T> template<typename T>
struct deduce_output_type_step2 { struct deduce_output_type_step2 {
typedef T type; using type = T;
}; };
template<typename R> template<typename R>
struct deduce_output_type_step2<detail::type_list<typed_continue_helper<R>>> { struct deduce_output_type_step2<type_list<typed_continue_helper<R>>> {
typedef typename lifted_result_type<R>::type type; using type = typename lifted_result_type<R>::type;
}; };
template<typename Signatures, typename InputTypes> template<typename Signatures, typename InputTypes>
struct deduce_output_type { struct deduce_output_type {
static constexpr int input_pos = detail::tl_find_if< static constexpr int input_pos = tl_find_if<
Signatures, input_is<InputTypes>::template eval>::value; Signatures,
input_is<InputTypes>::template eval
>::value;
static_assert(input_pos >= 0, "typed actor does not support given input"); static_assert(input_pos >= 0, "typed actor does not support given input");
typedef typename detail::tl_at<Signatures, input_pos>::type signature;
typedef typename deduce_output_type_step2< using signature = typename tl_at<Signatures, input_pos>::type;
typename signature::output_types>::type type;
using type = typename deduce_output_type_step2<
typename signature::output_types
>::type;
}; };
......
...@@ -92,7 +92,7 @@ struct types_array_impl { ...@@ -92,7 +92,7 @@ struct types_array_impl {
inline const uniform_type_info* operator[](size_t p) const { inline const uniform_type_info* operator[](size_t p) const {
return data[p]; return data[p];
} }
typedef const uniform_type_info* const* const_iterator; using const_iterator = const uniform_type_info* const*;
inline const_iterator begin() const { return std::begin(data); } inline const_iterator begin() const { return std::begin(data); }
inline const_iterator end() const { return std::end(data); } inline const_iterator end() const { return std::end(data); }
}; };
...@@ -109,10 +109,9 @@ struct types_array_impl<false, T...> { ...@@ -109,10 +109,9 @@ struct types_array_impl<false, T...> {
mutable std::atomic<const uniform_type_info**> pairs; mutable std::atomic<const uniform_type_info**> pairs;
// pairs[sizeof...(T)]; // pairs[sizeof...(T)];
types_array_impl() types_array_impl()
: tinfo_data{ta_util<std_tinf, detail::is_builtin<T>::value, : tinfo_data{ta_util<std_tinf, is_builtin<T>::value, T>::get()...} {
T>::get()...} {
bool static_init[sizeof...(T)] = {!std::is_same<T, anything>::value && bool static_init[sizeof...(T)] = {!std::is_same<T, anything>::value &&
detail::is_builtin<T>::value...}; is_builtin<T>::value...};
for (size_t i = 0; i < sizeof...(T); ++i) { for (size_t i = 0; i < sizeof...(T); ++i) {
if (static_init[i]) { if (static_init[i]) {
data[i].store(uniform_typeid(*(tinfo_data[i])), data[i].store(uniform_typeid(*(tinfo_data[i])),
...@@ -131,7 +130,7 @@ struct types_array_impl<false, T...> { ...@@ -131,7 +130,7 @@ struct types_array_impl<false, T...> {
} }
return result; return result;
} }
typedef const uniform_type_info* const* const_iterator; using const_iterator = const uniform_type_info* const*;
inline const_iterator begin() const { inline const_iterator begin() const {
auto result = pairs.load(); auto result = pairs.load();
if (result == nullptr) { if (result == nullptr) {
...@@ -157,14 +156,16 @@ struct types_array_impl<false, T...> { ...@@ -157,14 +156,16 @@ struct types_array_impl<false, T...> {
template<typename... T> template<typename... T>
struct types_array struct types_array
: types_array_impl< : types_array_impl<
detail::tl_forall<detail::type_list<T...>, detail::is_builtin>::value, tl_forall<type_list<T...>, is_builtin>::value,
T...> { T...> {
static constexpr size_t size = sizeof...(T); static constexpr size_t size = sizeof...(T);
typedef detail::type_list<T...> types; using types = type_list<T...>;
typedef typename detail::tl_filter_not<types, detail::is_anything>::type using filtered_types = typename tl_filter_not<
filtered_types; types,
is_anything
>::type;
static constexpr size_t filtered_size = static constexpr size_t filtered_size =
detail::tl_size<filtered_types>::value; tl_size<filtered_types>::value;
inline bool has_values() const { return false; } inline bool has_values() const { return false; }
}; };
...@@ -182,8 +183,8 @@ template<typename TypeList> ...@@ -182,8 +183,8 @@ template<typename TypeList>
struct static_types_array_from_type_list; struct static_types_array_from_type_list;
template<typename... T> template<typename... T>
struct static_types_array_from_type_list<detail::type_list<T...>> { struct static_types_array_from_type_list<type_list<T...>> {
typedef static_types_array<T...> type; using type = static_types_array<T...>;
}; };
...@@ -194,12 +195,12 @@ template<typename T> ...@@ -194,12 +195,12 @@ template<typename T>
struct static_type_list<T> { struct static_type_list<T> {
static const std::type_info* list; static const std::type_info* list;
static inline const std::type_info* by_offset(size_t offset) { static inline const std::type_info* by_offset(size_t offset) {
return offset == 0 ? list : &typeid(detail::type_list<>); return offset == 0 ? list : &typeid(type_list<>);
} }
}; };
template<typename T> template<typename T>
const std::type_info* static_type_list<T>::list = &typeid(detail::type_list<T>); const std::type_info* static_type_list<T>::list = &typeid(type_list<T>);
// utility for singleton-like access to a type_info instance of a type_list // utility for singleton-like access to a type_info instance of a type_list
template<typename T0, typename T1, typename... Ts> template<typename T0, typename T1, typename... Ts>
...@@ -212,7 +213,7 @@ struct static_type_list<T0, T1, Ts...> { ...@@ -212,7 +213,7 @@ struct static_type_list<T0, T1, Ts...> {
template<typename T0, typename T1, typename... Ts> template<typename T0, typename T1, typename... Ts>
const std::type_info* static_type_list<T0, T1, Ts...>::list = const std::type_info* static_type_list<T0, T1, Ts...>::list =
&typeid(detail::type_list<T0, T1, Ts...>); &typeid(type_list<T0, T1, Ts...>);
} // namespace detail } // namespace detail
} // namespace cppa } // namespace cppa
......
...@@ -28,31 +28,31 @@ namespace detail { ...@@ -28,31 +28,31 @@ namespace detail {
template<typename T> template<typename T>
struct unboxed { struct unboxed {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct unboxed<detail::wrapped<T>> { struct unboxed<detail::wrapped<T>> {
typedef typename detail::wrapped<T>::type type; using type = typename detail::wrapped<T>::type;
}; };
template<typename T> template<typename T>
struct unboxed<detail::wrapped<T>(&)()> { struct unboxed<detail::wrapped<T>(&)()> {
typedef typename detail::wrapped<T>::type type; using type = typename detail::wrapped<T>::type;
}; };
template<typename T> template<typename T>
struct unboxed<detail::wrapped<T>()> { struct unboxed<detail::wrapped<T>()> {
typedef typename detail::wrapped<T>::type type; using type = typename detail::wrapped<T>::type;
}; };
template<typename T> template<typename T>
struct unboxed<detail::wrapped<T>(*)()> { struct unboxed<detail::wrapped<T>(*)()> {
typedef typename detail::wrapped<T>::type type; using type = typename detail::wrapped<T>::type;
}; };
......
...@@ -73,7 +73,7 @@ class uniform_type_info_map { ...@@ -73,7 +73,7 @@ class uniform_type_info_map {
public: public:
typedef const uniform_type_info* pointer; using pointer = const uniform_type_info*;
virtual ~uniform_type_info_map(); virtual ~uniform_type_info_map();
......
...@@ -28,13 +28,13 @@ namespace detail { ...@@ -28,13 +28,13 @@ namespace detail {
*/ */
template<typename T> template<typename T>
struct wrapped { struct wrapped {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct wrapped<wrapped<T>> { struct wrapped<wrapped<T>> {
typedef typename wrapped<T>::type type; using type = typename wrapped<T>::type;
}; };
......
...@@ -28,7 +28,7 @@ struct extend_helper; ...@@ -28,7 +28,7 @@ struct extend_helper;
template<class D, class B> template<class D, class B>
struct extend_helper<D, B> { struct extend_helper<D, B> {
typedef B type; using type = B;
}; };
......
...@@ -55,9 +55,9 @@ struct invalid_actor_addr_t; ...@@ -55,9 +55,9 @@ struct invalid_actor_addr_t;
enum primitive_type : unsigned char; enum primitive_type : unsigned char;
enum class atom_value : uint64_t; enum class atom_value : uint64_t;
// intrusive pointer typedefs // intrusive pointer types
typedef intrusive_ptr<abstract_group> abstract_group_ptr; using abstract_group_ptr = intrusive_ptr<abstract_group>;
typedef intrusive_ptr<actor_proxy> actor_proxy_ptr; using actor_proxy_ptr = intrusive_ptr<actor_proxy>;
// functions // functions
template<typename T, typename U> template<typename T, typename U>
......
...@@ -40,11 +40,11 @@ class intrusive_ptr : detail::comparable<intrusive_ptr<T>>, ...@@ -40,11 +40,11 @@ class intrusive_ptr : detail::comparable<intrusive_ptr<T>>,
public: public:
typedef T* pointer; using pointer = T* ;
typedef const T* const_pointer; using const_pointer = const T*;
typedef T element_type; using element_type = T ;
typedef T& reference; using reference = T& ;
typedef const T& const_reference; using const_reference = const T&;
constexpr intrusive_ptr() : m_ptr(nullptr) { } constexpr intrusive_ptr() : m_ptr(nullptr) { }
......
...@@ -55,7 +55,7 @@ class broker : public extend<local_actor>:: ...@@ -55,7 +55,7 @@ class broker : public extend<local_actor>::
friend class policy::sequential_invoke; friend class policy::sequential_invoke;
typedef combined_type super; using super = combined_type;
public: public:
...@@ -219,8 +219,7 @@ class broker : public extend<local_actor>:: ...@@ -219,8 +219,7 @@ class broker : public extend<local_actor>::
actor fork(F fun, connection_handle hdl, Ts&&... vs) { actor fork(F fun, connection_handle hdl, Ts&&... vs) {
// provoke compile-time errors early // provoke compile-time errors early
using fun_res = decltype(fun(this, hdl, std::forward<Ts>(vs)...)); using fun_res = decltype(fun(this, hdl, std::forward<Ts>(vs)...));
// this static assert only prevents a warning about // prevent warning about unused local type
// unused local typedef
static_assert(std::is_same<fun_res, fun_res>::value, static_assert(std::is_same<fun_res, fun_res>::value,
"your compiler is lying to you"); "your compiler is lying to you");
auto i = m_scribes.find(hdl); auto i = m_scribes.find(hdl);
...@@ -346,7 +345,7 @@ class broker : public extend<local_actor>:: ...@@ -346,7 +345,7 @@ class broker : public extend<local_actor>::
static broker_ptr from(F fun) { static broker_ptr from(F fun) {
// transform to STD function here, because GCC is unable // transform to STD function here, because GCC is unable
// to select proper overload otherwise ... // to select proper overload otherwise ...
typedef decltype(fun((broker*)nullptr)) fres; using fres = decltype(fun((broker*)nullptr));
std::function<fres(broker*)> stdfun{std::move(fun)}; std::function<fres(broker*)> stdfun{std::move(fun)};
return from_impl(std::move(stdfun)); return from_impl(std::move(stdfun));
} }
...@@ -399,9 +398,9 @@ class broker : public extend<local_actor>:: ...@@ -399,9 +398,9 @@ class broker : public extend<local_actor>::
void cleanup(uint32_t reason) override; void cleanup(uint32_t reason) override;
typedef intrusive_ptr<scribe> scribe_pointer; using scribe_pointer = intrusive_ptr<scribe>;
typedef intrusive_ptr<doorman> doorman_pointer; using doorman_pointer = intrusive_ptr<doorman>;
bool initialized() const; bool initialized() const;
......
...@@ -95,11 +95,11 @@ namespace network { ...@@ -95,11 +95,11 @@ namespace network {
// some more annoying platform-dependent bootstrapping // some more annoying platform-dependent bootstrapping
#ifdef CPPA_WINDOWS #ifdef CPPA_WINDOWS
typedef SOCKET native_socket_t; using native_socket_t = SOCKET;
typedef const char* setsockopt_ptr; using setsockopt_ptr = const char*;
typedef const char* socket_send_ptr; using socket_send_ptr = const char*;
typedef char* socket_recv_ptr; using socket_recv_ptr = char*;
typedef int socklen_t; using socklen_t = int;
constexpr native_socket_t invalid_socket = INVALID_SOCKET; constexpr native_socket_t invalid_socket = INVALID_SOCKET;
inline int last_socket_error() { return WSAGetLastError(); } inline int last_socket_error() { return WSAGetLastError(); }
inline bool would_block_or_temporarily_unavailable(int errcode) { inline bool would_block_or_temporarily_unavailable(int errcode) {
...@@ -108,10 +108,10 @@ namespace network { ...@@ -108,10 +108,10 @@ namespace network {
constexpr int ec_out_of_memory = WSAENOBUFS; constexpr int ec_out_of_memory = WSAENOBUFS;
constexpr int ec_interrupted_syscall = WSAEINTR; constexpr int ec_interrupted_syscall = WSAEINTR;
#else #else
typedef int native_socket_t; using native_socket_t = int;
typedef const void* setsockopt_ptr; using setsockopt_ptr = const void*;
typedef const void* socket_send_ptr; using socket_send_ptr = const void*;
typedef void* socket_recv_ptr; using socket_recv_ptr = void*;
constexpr native_socket_t invalid_socket = -1; constexpr native_socket_t invalid_socket = -1;
inline void closesocket(native_socket_t fd) { close(fd); } inline void closesocket(native_socket_t fd) { close(fd); }
inline int last_socket_error() { return errno; } inline int last_socket_error() { return errno; }
......
...@@ -46,7 +46,7 @@ class sync_request_info : public extend<memory_managed>:: ...@@ -46,7 +46,7 @@ class sync_request_info : public extend<memory_managed>::
public: public:
typedef sync_request_info* pointer; using pointer = sync_request_info*;
~sync_request_info(); ~sync_request_info();
...@@ -62,7 +62,7 @@ class sync_request_info : public extend<memory_managed>:: ...@@ -62,7 +62,7 @@ class sync_request_info : public extend<memory_managed>::
class remote_actor_proxy : public actor_proxy { class remote_actor_proxy : public actor_proxy {
typedef actor_proxy super; using super = actor_proxy;
public: public:
......
...@@ -49,7 +49,7 @@ actor spawn_io_client(F fun, const std::string& host, ...@@ -49,7 +49,7 @@ actor spawn_io_client(F fun, const std::string& host,
auto hdl = network::conn_hdl_from_socket(sock); auto hdl = network::conn_hdl_from_socket(sock);
// provoke compiler error early // provoke compiler error early
using fun_res = decltype(fun((broker*) 0, hdl, std::forward<Ts>(args)...)); using fun_res = decltype(fun((broker*) 0, hdl, std::forward<Ts>(args)...));
// prevent warning about unused local typedef // prevent warning about unused local type
static_assert(std::is_same<fun_res, fun_res>::value, static_assert(std::is_same<fun_res, fun_res>::value,
"your compiler is lying to you"); "your compiler is lying to you");
return spawn_class<broker::functor_based>( return spawn_class<broker::functor_based>(
......
...@@ -36,7 +36,7 @@ struct typed_remote_actor_helper; ...@@ -36,7 +36,7 @@ struct typed_remote_actor_helper;
template<typename... Ts> template<typename... Ts>
struct typed_remote_actor_helper<detail::type_list<Ts...>> { struct typed_remote_actor_helper<detail::type_list<Ts...>> {
typedef typed_actor<Ts...> return_type; using return_type = typed_actor<Ts...>;
template<typename... Vs> template<typename... Vs>
return_type operator()(Vs&&... vs) { return_type operator()(Vs&&... vs) {
auto iface = return_type::get_interface(); auto iface = return_type::get_interface();
......
...@@ -59,13 +59,13 @@ class sync_handle_helper; ...@@ -59,13 +59,13 @@ class sync_handle_helper;
*/ */
class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> { class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
typedef combined_type super; using super = combined_type;
public: public:
typedef detail::disposer del; using del = detail::disposer;
typedef detail::single_reader_queue<mailbox_element, del> mailbox_type; using mailbox_type = detail::single_reader_queue<mailbox_element, del>;
~local_actor(); ~local_actor();
...@@ -546,7 +546,7 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> { ...@@ -546,7 +546,7 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
* @brief A smart pointer to a {@link local_actor} instance. * @brief A smart pointer to a {@link local_actor} instance.
* @relates local_actor * @relates local_actor
*/ */
typedef intrusive_ptr<local_actor> local_actor_ptr; using local_actor_ptr = intrusive_ptr<local_actor>;
/****************************************************************************** /******************************************************************************
* inline and template member function implementations * * inline and template member function implementations *
......
...@@ -31,7 +31,7 @@ namespace cppa { ...@@ -31,7 +31,7 @@ namespace cppa {
template<class Base, class Subtype> template<class Base, class Subtype>
class mailbox_based : public Base { class mailbox_based : public Base {
typedef detail::disposer del; using del = detail::disposer;
public: public:
...@@ -55,9 +55,9 @@ class mailbox_based : public Base { ...@@ -55,9 +55,9 @@ class mailbox_based : public Base {
protected: protected:
typedef mailbox_based combined_type; using combined_type = mailbox_based;
typedef detail::single_reader_queue<mailbox_element, del> mailbox_type; using mailbox_type = detail::single_reader_queue<mailbox_element, del>;
template<typename... Ts> template<typename... Ts>
mailbox_based(Ts&&... args) : Base(std::forward<Ts>(args)...) { } mailbox_based(Ts&&... args) : Base(std::forward<Ts>(args)...) { }
......
...@@ -34,8 +34,8 @@ namespace cppa { ...@@ -34,8 +34,8 @@ namespace cppa {
class local_actor; class local_actor;
class mailbox_element class mailbox_element : public extend<memory_managed>::
: public extend<memory_managed>::with<mixin::memory_cached> { with<mixin::memory_cached> {
friend class local_actor; friend class local_actor;
friend class detail::memory; friend class detail::memory;
...@@ -69,8 +69,10 @@ class mailbox_element ...@@ -69,8 +69,10 @@ class mailbox_element
}; };
typedef std::unique_ptr<mailbox_element, detail::disposer> using unique_mailbox_element_pointer = std::unique_ptr<
unique_mailbox_element_pointer; mailbox_element,
detail::disposer
>;
} // namespace cppa } // namespace cppa
......
...@@ -49,7 +49,7 @@ struct long_constant { ...@@ -49,7 +49,7 @@ struct long_constant {
}; };
typedef long_constant<-1l> minus1l; using minus1l = long_constant<-1l>;
template<typename T1, typename T2> template<typename T1, typename T2>
inline T2& deduce_const(T1&, T2& rhs) { inline T2& deduce_const(T1&, T2& rhs) {
...@@ -63,16 +63,17 @@ inline const T2& deduce_const(const T1&, T2& rhs) { ...@@ -63,16 +63,17 @@ inline const T2& deduce_const(const T1&, T2& rhs) {
template<class FilteredPattern> template<class FilteredPattern>
struct invoke_util_base { struct invoke_util_base {
typedef typename detail::tl_apply<FilteredPattern, pseudo_tuple>::type using tuple_type = typename detail::tl_apply<
tuple_type; FilteredPattern,
pseudo_tuple
>::type;
}; };
// covers wildcard_position::multiple and wildcard_position::in_between // covers wildcard_position::multiple and wildcard_position::in_between
template<wildcard_position, class Pattern, class FilteredPattern> template<wildcard_position, class Pattern, class FilteredPattern>
struct invoke_util_impl : invoke_util_base<FilteredPattern> { struct invoke_util_impl : invoke_util_base<FilteredPattern> {
typedef invoke_util_base<FilteredPattern> super; using super = invoke_util_base<FilteredPattern>;
template<class Tuple> template<class Tuple>
static bool can_invoke(const std::type_info& type_token, const Tuple& tup) { static bool can_invoke(const std::type_info& type_token, const Tuple& tup) {
...@@ -110,7 +111,7 @@ struct invoke_util_impl< ...@@ -110,7 +111,7 @@ struct invoke_util_impl<
wildcard_position::nil, detail::empty_type_list, wildcard_position::nil, detail::empty_type_list,
detail::empty_type_list> : invoke_util_base<detail::empty_type_list> { detail::empty_type_list> : invoke_util_base<detail::empty_type_list> {
typedef invoke_util_base<detail::empty_type_list> super; using super = invoke_util_base<detail::empty_type_list>;
template<typename PtrType, class Tuple> template<typename PtrType, class Tuple>
static bool prepare_invoke(typename super::tuple_type&, static bool prepare_invoke(typename super::tuple_type&,
...@@ -131,13 +132,13 @@ struct invoke_util_impl< ...@@ -131,13 +132,13 @@ struct invoke_util_impl<
wildcard_position::nil, Pattern, wildcard_position::nil, Pattern,
detail::type_list<Ts...>> : invoke_util_base<detail::type_list<Ts...>> { detail::type_list<Ts...>> : invoke_util_base<detail::type_list<Ts...>> {
typedef invoke_util_base<detail::type_list<Ts...>> super; using super = invoke_util_base<detail::type_list<Ts...>>;
typedef typename super::tuple_type tuple_type; using tuple_type = typename super::tuple_type;
typedef std::tuple<Ts...> native_data_type; using native_data_type = std::tuple<Ts...>;
typedef typename detail::static_types_array<Ts...> arr_type; using arr_type = typename detail::static_types_array<Ts...>;
template<class Tup> template<class Tup>
static bool prepare_invoke(std::false_type, tuple_type&, Tup&) { static bool prepare_invoke(std::false_type, tuple_type&, Tup&) {
...@@ -175,9 +176,11 @@ struct invoke_util_impl< ...@@ -175,9 +176,11 @@ struct invoke_util_impl<
detail::message_data>::value == true>::type* = 0) { detail::message_data>::value == true>::type* = 0) {
if (arg_types == typeid(detail::type_list<Ts...>)) { if (arg_types == typeid(detail::type_list<Ts...>)) {
if (native_arg) { if (native_arg) {
typedef typename std::conditional< using cast_type = typename std::conditional<
std::is_const<PtrType>::value, const native_data_type*, std::is_const<PtrType>::value,
native_data_type*>::type cast_type; const native_data_type*,
native_data_type*
>::type;
auto arg = reinterpret_cast<cast_type>(native_arg); auto arg = reinterpret_cast<cast_type>(native_arg);
for (size_t i = 0; i < sizeof...(Ts); ++i) { for (size_t i = 0; i < sizeof...(Ts); ++i) {
result[i] = const_cast<void*>( result[i] = const_cast<void*>(
...@@ -217,7 +220,7 @@ struct invoke_util_impl< ...@@ -217,7 +220,7 @@ struct invoke_util_impl<
wildcard_position::leading, detail::type_list<anything>, wildcard_position::leading, detail::type_list<anything>,
detail::empty_type_list> : invoke_util_base<detail::empty_type_list> { detail::empty_type_list> : invoke_util_base<detail::empty_type_list> {
typedef invoke_util_base<detail::empty_type_list> super; using super = invoke_util_base<detail::empty_type_list>;
template<class Tuple> template<class Tuple>
static inline bool can_invoke(const std::type_info&, const Tuple&) { static inline bool can_invoke(const std::type_info&, const Tuple&) {
...@@ -238,14 +241,14 @@ struct invoke_util_impl< ...@@ -238,14 +241,14 @@ struct invoke_util_impl<
wildcard_position::trailing, Pattern, wildcard_position::trailing, Pattern,
detail::type_list<Ts...>> : invoke_util_base<detail::type_list<Ts...>> { detail::type_list<Ts...>> : invoke_util_base<detail::type_list<Ts...>> {
typedef invoke_util_base<detail::type_list<Ts...>> super; using super = invoke_util_base<detail::type_list<Ts...>>;
template<class Tuple> template<class Tuple>
static bool can_invoke(const std::type_info& arg_types, const Tuple& tup) { static bool can_invoke(const std::type_info& arg_types, const Tuple& tup) {
if (arg_types == typeid(detail::type_list<Ts...>)) { if (arg_types == typeid(detail::type_list<Ts...>)) {
return true; return true;
} }
typedef detail::static_types_array<Ts...> arr_type; using arr_type = detail::static_types_array<Ts...>;
auto& arr = arr_type::arr; auto& arr = arr_type::arr;
if (tup.size() < sizeof...(Ts)) { if (tup.size() < sizeof...(Ts)) {
return false; return false;
...@@ -276,14 +279,14 @@ struct invoke_util_impl< ...@@ -276,14 +279,14 @@ struct invoke_util_impl<
wildcard_position::leading, Pattern, wildcard_position::leading, Pattern,
detail::type_list<Ts...>> : invoke_util_base<detail::type_list<Ts...>> { detail::type_list<Ts...>> : invoke_util_base<detail::type_list<Ts...>> {
typedef invoke_util_base<detail::type_list<Ts...>> super; using super = invoke_util_base<detail::type_list<Ts...>>;
template<class Tuple> template<class Tuple>
static bool can_invoke(const std::type_info& arg_types, const Tuple& tup) { static bool can_invoke(const std::type_info& arg_types, const Tuple& tup) {
if (arg_types == typeid(detail::type_list<Ts...>)) { if (arg_types == typeid(detail::type_list<Ts...>)) {
return true; return true;
} }
typedef detail::static_types_array<Ts...> arr_type; using arr_type = detail::static_types_array<Ts...>;
auto& arr = arr_type::arr; auto& arr = arr_type::arr;
if (tup.size() < sizeof...(Ts)) return false; if (tup.size() < sizeof...(Ts)) return false;
size_t i = tup.size() - sizeof...(Ts); size_t i = tup.size() - sizeof...(Ts);
...@@ -321,7 +324,7 @@ template<class Expr, class Projections, class Signature, class Pattern> ...@@ -321,7 +324,7 @@ template<class Expr, class Projections, class Signature, class Pattern>
class match_expr_case class match_expr_case
: public get_lifted_fun<Expr, Projections, Signature>::type { : public get_lifted_fun<Expr, Projections, Signature>::type {
typedef typename get_lifted_fun<Expr, Projections, Signature>::type super; using super = typename get_lifted_fun<Expr, Projections, Signature>::type;
public: public:
...@@ -329,77 +332,107 @@ class match_expr_case ...@@ -329,77 +332,107 @@ class match_expr_case
match_expr_case(Ts&&... args) match_expr_case(Ts&&... args)
: super(std::forward<Ts>(args)...) {} : super(std::forward<Ts>(args)...) {}
typedef Pattern pattern_type; using pattern_type = Pattern;
}; };
template<class Expr, class Transformers, class Pattern> template<class Expr, class Transformers, class Pattern>
struct get_case_ { struct get_case_ {
typedef typename detail::get_callable_trait<Expr>::type ctrait; using ctrait = typename detail::get_callable_trait<Expr>::type;
typedef typename detail::tl_filter_not_type<Pattern, anything>::type using filtered_pattern = typename detail::tl_filter_not_type<
filtered_pattern; Pattern,
anything
>::type;
typedef typename detail::tl_pad_right< using padded_transformers = typename detail::tl_pad_right<
Transformers, detail::tl_size<filtered_pattern>::value>::type Transformers,
padded_transformers; detail::tl_size<filtered_pattern>::value
>::type;
typedef typename detail::tl_map<filtered_pattern, std::add_const, using base_signature = typename detail::tl_map<
std::add_lvalue_reference>::type filtered_pattern,
base_signature; std::add_const,
std::add_lvalue_reference
>::type;
typedef typename detail::tl_map_conditional< using padded_expr_args = typename detail::tl_map_conditional<
typename detail::tl_pad_left< typename detail::tl_pad_left<
typename ctrait::arg_types, typename ctrait::arg_types,
detail::tl_size<filtered_pattern>::value>::type, detail::tl_size<filtered_pattern>::value
std::is_lvalue_reference, false, std::add_const, >::type,
std::add_lvalue_reference>::type padded_expr_args; std::is_lvalue_reference,
false,
std::add_const,
std::add_lvalue_reference
>::type;
// override base signature with required argument types of Expr // override base signature with required argument types of Expr
// and result types of transformation // and result types of transformation
typedef typename detail::tl_zip< using partial_fun_signature = typename detail::tl_zip<
typename detail::tl_map<padded_transformers, detail::map_to_result_type, typename detail::tl_map<
padded_transformers,
detail::map_to_result_type,
detail::rm_optional, detail::rm_optional,
std::add_lvalue_reference>::type, std::add_lvalue_reference
typename detail::tl_zip<padded_expr_args, base_signature, >::type,
detail::left_or_right>::type, typename detail::tl_zip<
detail::left_or_right>::type partial_fun_signature; padded_expr_args,
base_signature,
detail::left_or_right
>::type,
detail::left_or_right
>::type;
// 'inherit' mutable references from partial_fun_signature // 'inherit' mutable references from partial_fun_signature
// for arguments without transformation // for arguments without transformation
typedef typename detail::tl_zip< using projection_signature = typename detail::tl_zip<
typename detail::tl_zip<padded_transformers, partial_fun_signature, typename detail::tl_zip<
detail::if_not_left>::type, padded_transformers,
base_signature, detail::deduce_ref_type>::type projection_signature; partial_fun_signature,
detail::if_not_left
typedef match_expr_case<Expr, padded_transformers, projection_signature, >::type,
Pattern> type; base_signature,
detail::deduce_ref_type
>::type;
using type = match_expr_case<
Expr,
padded_transformers,
projection_signature,
Pattern
>;
}; };
template<bool Complete, class Expr, class Trans, class Pattern> template<bool Complete, class Expr, class Trans, class Pattern>
struct get_case { struct get_case {
typedef typename get_case_<Expr, Trans, Pattern>::type type; using type = typename get_case_<Expr, Trans, Pattern>::type;
}; };
template<class Expr, class Trans, class Pattern> template<class Expr, class Trans, class Pattern>
struct get_case<false, Expr, Trans, Pattern> { struct get_case<false, Expr, Trans, Pattern> {
typedef typename detail::tl_pop_back<Pattern>::type lhs_pattern; using lhs_pattern = typename detail::tl_pop_back<Pattern>::type;
typedef typename detail::tl_map< using rhs_pattern = typename detail::tl_map<
typename detail::get_callable_trait<Expr>::arg_types, typename detail::get_callable_trait<Expr>::arg_types,
detail::rm_const_and_ref>::type rhs_pattern; detail::rm_const_and_ref
typedef typename get_case_< >::type;
Expr, Trans, using type = typename get_case_<
typename detail::tl_concat<lhs_pattern, rhs_pattern>::type>::type type; Expr,
Trans,
typename detail::tl_concat<
lhs_pattern,
rhs_pattern
>::type
>::type;
}; };
template<typename Fun> template<typename Fun>
struct has_bool_result { struct has_bool_result {
typedef typename Fun::result_type result_type; using result_type = typename Fun::result_type;
static constexpr bool value = std::is_same<bool, result_type>::value; static constexpr bool value = std::is_same<bool, result_type>::value;
typedef std::integral_constant<bool, value> token_type; using token_type = std::integral_constant<bool, value>;
}; };
...@@ -440,9 +473,9 @@ Result unroll_expr(PPFPs& fs, uint64_t bitmask, long_constant<N>, ...@@ -440,9 +473,9 @@ Result unroll_expr(PPFPs& fs, uint64_t bitmask, long_constant<N>,
} }
if ((bitmask & (0x01 << N)) == 0) return none; if ((bitmask & (0x01 << N)) == 0) return none;
auto& f = get<N>(fs); auto& f = get<N>(fs);
typedef typename detail::rm_const_and_ref<decltype(f)>::type Fun; using Fun = typename detail::rm_const_and_ref<decltype(f)>::type;
typedef typename Fun::pattern_type pattern_type; using pattern_type = typename Fun::pattern_type;
typedef detail::invoke_util<pattern_type> policy; using policy = detail::invoke_util<pattern_type>;
typename policy::tuple_type targs; typename policy::tuple_type targs;
if (policy::prepare_invoke(targs, type_token, is_dynamic, ptr, tup)) { if (policy::prepare_invoke(targs, type_token, is_dynamic, ptr, tup)) {
auto is = detail::get_indices(targs); auto is = detail::get_indices(targs);
...@@ -464,38 +497,40 @@ template<class Case, long N, class Tuple> ...@@ -464,38 +497,40 @@ template<class Case, long N, class Tuple>
inline uint64_t calc_bitmask(Case& fs, long_constant<N>, inline uint64_t calc_bitmask(Case& fs, long_constant<N>,
const std::type_info& tinf, const Tuple& tup) { const std::type_info& tinf, const Tuple& tup) {
auto& f = get<N>(fs); auto& f = get<N>(fs);
typedef typename detail::rm_const_and_ref<decltype(f)>::type Fun; using Fun = typename detail::rm_const_and_ref<decltype(f)>::type;
typedef typename Fun::pattern_type pattern_type; using pattern_type = typename Fun::pattern_type;
typedef detail::invoke_util<pattern_type> policy; using policy = detail::invoke_util<pattern_type>;
uint64_t result = policy::can_invoke(tinf, tup) ? (0x01 << N) : 0x00; uint64_t result = policy::can_invoke(tinf, tup) ? (0x01 << N) : 0x00;
return result | calc_bitmask(fs, long_constant<N - 1l>(), tinf, tup); return result | calc_bitmask(fs, long_constant<N - 1l>(), tinf, tup);
} }
template<bool IsManipulator, typename T0, typename T1> template<bool IsManipulator, typename T0, typename T1>
struct mexpr_fwd_ { struct mexpr_fwd_ {
typedef T1 type; using type = T1;
}; };
template<typename T> template<typename T>
struct mexpr_fwd_<false, const T&, T> { struct mexpr_fwd_<false, const T&, T> {
typedef std::reference_wrapper<const T> type; using type = std::reference_wrapper<const T>;
}; };
template<typename T> template<typename T>
struct mexpr_fwd_<true, T&, T> { struct mexpr_fwd_<true, T&, T> {
typedef std::reference_wrapper<T> type; using type = std::reference_wrapper<T>;
}; };
template<bool IsManipulator, typename T> template<bool IsManipulator, typename T>
struct mexpr_fwd { struct mexpr_fwd {
typedef typename mexpr_fwd_< using type = typename mexpr_fwd_<
IsManipulator, T, IsManipulator,
T,
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename detail::rm_const_and_ref<T>::type>::type>::type type; typename detail::rm_const_and_ref<T>::type
>::type
>::type;
}; };
// detach_if_needed(message tup, bool do_detach) // detach_if_needed(message tup, bool do_detach)
...@@ -527,15 +562,15 @@ inline const void* fetch_native_data(const Ptr& ptr, std::false_type) { ...@@ -527,15 +562,15 @@ inline const void* fetch_native_data(const Ptr& ptr, std::false_type) {
template<typename T> template<typename T>
struct is_manipulator_case { struct is_manipulator_case {
// static constexpr bool value = T::second_type::manipulates_args; // static constexpr bool value = T::second_type::manipulates_args;
typedef typename T::arg_types arg_types; using arg_types = typename T::arg_types;
static constexpr bool value = tl_exists<arg_types, is_mutable_ref>::value; static constexpr bool value = tl_exists<arg_types, is_mutable_ref>::value;
}; };
template<typename T> template<typename T>
struct get_case_result { struct get_case_result {
// typedef typename T::second_type::result_type type; // using type = typename T::second_type::result_type;
typedef typename T::result_type type; using type = typename T::result_type;
}; };
...@@ -549,7 +584,7 @@ struct match_result_from_type_list; ...@@ -549,7 +584,7 @@ struct match_result_from_type_list;
template<typename... Ts> template<typename... Ts>
struct match_result_from_type_list<detail::type_list<Ts...>> { struct match_result_from_type_list<detail::type_list<Ts...>> {
typedef variant<none_t, typename lift_void<Ts>::type...> type; using type = variant<none_t, typename lift_void<Ts>::type...>;
}; };
...@@ -564,17 +599,21 @@ class match_expr { ...@@ -564,17 +599,21 @@ class match_expr {
public: public:
typedef detail::type_list<Cs...> cases_list; using cases_list = detail::type_list<Cs...>;
typedef typename match_result_from_type_list< using result_type = typename match_result_from_type_list<
typename detail::tl_distinct<typename detail::tl_map< typename detail::tl_distinct<
cases_list, detail::get_case_result>::type>::type>::type typename detail::tl_map<
result_type; cases_list,
detail::get_case_result
>::type
>::type
>::type;
static constexpr bool has_manipulator = static constexpr bool has_manipulator =
detail::tl_exists<cases_list, detail::is_manipulator_case>::value; detail::tl_exists<cases_list, detail::is_manipulator_case>::value;
typedef detail::long_constant<sizeof...(Cs) - 1l> idx_token_type; using idx_token_type = detail::long_constant<sizeof...(Cs) - 1l>;
static constexpr idx_token_type idx_token = idx_token_type{}; static constexpr idx_token_type idx_token = idx_token_type{};
...@@ -626,7 +665,7 @@ class match_expr { ...@@ -626,7 +665,7 @@ class match_expr {
static constexpr size_t cache_size = 10; static constexpr size_t cache_size = 10;
typedef std::pair<const std::type_info*, uint64_t> cache_element; using cache_element = std::pair<const std::type_info*, uint64_t>;
std::vector<cache_element> m_cache; std::vector<cache_element> m_cache;
...@@ -686,7 +725,7 @@ class match_expr { ...@@ -686,7 +725,7 @@ class match_expr {
} }
std::integral_constant<bool, has_manipulator> mutator_token; std::integral_constant<bool, has_manipulator> mutator_token;
// returns either a reference or a new object // returns either a reference or a new object
typedef decltype(detail::detach_if_needed(tup, mutator_token)) detached; using detached = decltype(detail::detach_if_needed(tup, mutator_token));
detached tref = detail::detach_if_needed(tup, mutator_token); detached tref = detail::detach_if_needed(tup, mutator_token);
auto& vals = tref.vals(); auto& vals = tref.vals();
auto ndp = fetch_native_data(vals, mutator_token); auto ndp = fetch_native_data(vals, mutator_token);
...@@ -798,13 +837,17 @@ behavior_impl_ptr match_expr_concat(const T0& arg0, const T1& arg1, ...@@ -798,13 +837,17 @@ behavior_impl_ptr match_expr_concat(const T0& arg0, const T1& arg1,
// some more convenience functions // some more convenience functions
template<typename F, class E = typename std::enable_if< template<typename F,
detail::is_callable<F>::value>::type> class E = typename std::enable_if<detail::is_callable<F>::value>::type>
match_expr<typename get_case<false, F, detail::empty_type_list, match_expr<typename get_case<false, F, detail::empty_type_list,
detail::empty_type_list>::type> detail::empty_type_list>::type>
lift_to_match_expr(F fun) { lift_to_match_expr(F fun) {
typedef typename get_case<false, F, detail::empty_type_list, using result_type = typename get_case<
detail::empty_type_list>::type result_type; false,
F,
detail::empty_type_list,
detail::empty_type_list
>::type;
return result_type{std::move(fun)}; return result_type{std::move(fun)};
} }
......
...@@ -47,17 +47,17 @@ class message { ...@@ -47,17 +47,17 @@ class message {
/** /**
* @brief A raw pointer to the data. * @brief A raw pointer to the data.
*/ */
typedef detail::message_data* raw_ptr; using raw_ptr = detail::message_data*;
/** /**
* @brief A (COW) smart pointer to the data. * @brief A (COW) smart pointer to the data.
*/ */
typedef detail::message_data::ptr data_ptr; using data_ptr = detail::message_data::ptr;
/** /**
* @brief An iterator to access each element as <tt>const void*</tt>. * @brief An iterator to access each element as <tt>const void*</tt>.
*/ */
typedef detail::message_data::const_iterator const_iterator; using const_iterator = detail::message_data::const_iterator;
/** /**
* @brief Creates an empty tuple. * @brief Creates an empty tuple.
...@@ -247,8 +247,8 @@ typename std::enable_if< ...@@ -247,8 +247,8 @@ typename std::enable_if<
message>::type message>::type
make_message(T&& arg, Ts&&... args) { make_message(T&& arg, Ts&&... args) {
using namespace detail; using namespace detail;
typedef tuple_vals<typename strip_and_convert<T>::type, using data = tuple_vals<typename strip_and_convert<T>::type,
typename strip_and_convert<Ts>::type...> data; typename strip_and_convert<Ts>::type...>;
auto ptr = new data(std::forward<T>(arg), std::forward<Ts>(args)...); auto ptr = new data(std::forward<T>(arg), std::forward<Ts>(args)...);
return message{detail::message_data::ptr{ptr}}; return message{detail::message_data::ptr{ptr}};
} }
......
...@@ -124,7 +124,7 @@ class message_builder { ...@@ -124,7 +124,7 @@ class message_builder {
template<typename T> template<typename T>
message_builder& message_builder&
append_impl(typename detail::implicit_conversions<T>::type what) { append_impl(typename detail::implicit_conversions<T>::type what) {
typedef decltype(what) type; using type = decltype(what);
auto uti = uniform_typeid<type>(); auto uti = uniform_typeid<type>();
auto uval = uti->create(); auto uval = uti->create();
*reinterpret_cast<type*>(uval->val) = std::move(what); *reinterpret_cast<type*>(uval->val) = std::move(what);
......
...@@ -54,7 +54,7 @@ class message_handler { ...@@ -54,7 +54,7 @@ class message_handler {
/** @cond PRIVATE */ /** @cond PRIVATE */
typedef intrusive_ptr<detail::behavior_impl> impl_ptr; using impl_ptr = intrusive_ptr<detail::behavior_impl>;
inline auto as_behavior_impl() const -> impl_ptr; inline auto as_behavior_impl() const -> impl_ptr;
......
...@@ -34,21 +34,23 @@ namespace mixin { ...@@ -34,21 +34,23 @@ namespace mixin {
template<class Base, class Subtype, class BehaviorType> template<class Base, class Subtype, class BehaviorType>
class behavior_stack_based_impl : public single_timeout<Base, Subtype> { class behavior_stack_based_impl : public single_timeout<Base, Subtype> {
typedef single_timeout<Base, Subtype> super; using super = single_timeout<Base, Subtype>;
public: public:
/************************************************************************** /**************************************************************************
* typedefs and constructor * * types and constructor *
**************************************************************************/ **************************************************************************/
typedef BehaviorType behavior_type; using behavior_type = BehaviorType;
typedef behavior_stack_based_impl combined_type; using combined_type = behavior_stack_based_impl;
typedef response_handle<behavior_stack_based_impl, message, using response_handle_type = response_handle<
nonblocking_response_handle_tag> behavior_stack_based_impl,
response_handle_type; message,
nonblocking_response_handle_tag
>;
template<typename... Ts> template<typename... Ts>
behavior_stack_based_impl(Ts&&... vs) behavior_stack_based_impl(Ts&&... vs)
...@@ -158,11 +160,11 @@ class behavior_stack_based { ...@@ -158,11 +160,11 @@ class behavior_stack_based {
template<class Base, class Subtype> template<class Base, class Subtype>
class impl : public behavior_stack_based_impl<Base, Subtype, BehaviorType> { class impl : public behavior_stack_based_impl<Base, Subtype, BehaviorType> {
typedef behavior_stack_based_impl<Base, Subtype, BehaviorType> super; using super = behavior_stack_based_impl<Base, Subtype, BehaviorType>;
public: public:
typedef impl combined_type; using combined_type = impl;
template<typename... Ts> template<typename... Ts>
impl(Ts&&... args) impl(Ts&&... args)
......
...@@ -37,9 +37,9 @@ class functor_based : public Base { ...@@ -37,9 +37,9 @@ class functor_based : public Base {
template<typename F, typename... Ts> template<typename F, typename... Ts>
functor_based(F f, Ts&&... vs) { functor_based(F f, Ts&&... vs) {
typedef typename detail::get_callable_trait<F>::type trait; using trait = typename detail::get_callable_trait<F>::type;
typedef typename trait::arg_types arg_types; using arg_types = typename trait::arg_types;
typedef typename trait::result_type result_type; using result_type = typename trait::result_type;
constexpr bool returns_behavior = constexpr bool returns_behavior =
std::is_convertible<result_type, behavior>::value; std::is_convertible<result_type, behavior>::value;
constexpr bool uses_first_arg = std::is_same< constexpr bool uses_first_arg = std::is_same<
......
...@@ -32,7 +32,7 @@ namespace mixin { ...@@ -32,7 +32,7 @@ namespace mixin {
template<class Base, class Subtype> template<class Base, class Subtype>
class mailbox_based : public Base { class mailbox_based : public Base {
typedef detail::disposer del; using del = detail::disposer;
public: public:
...@@ -56,9 +56,9 @@ class mailbox_based : public Base { ...@@ -56,9 +56,9 @@ class mailbox_based : public Base {
protected: protected:
typedef mailbox_based combined_type; using combined_type = mailbox_based;
typedef detail::single_reader_queue<mailbox_element, del> mailbox_type; using mailbox_type = detail::single_reader_queue<mailbox_element, del>;
template<typename... Ts> template<typename... Ts>
mailbox_based(Ts&&... args) mailbox_based(Ts&&... args)
......
...@@ -41,7 +41,7 @@ class memory_cached : public Base { ...@@ -41,7 +41,7 @@ class memory_cached : public Base {
protected: protected:
typedef memory_cached combined_type; using combined_type = memory_cached;
public: public:
......
...@@ -32,11 +32,11 @@ namespace mixin { ...@@ -32,11 +32,11 @@ namespace mixin {
template<class Base, class Subtype> template<class Base, class Subtype>
class single_timeout : public Base { class single_timeout : public Base {
typedef Base super; using super = Base;
public: public:
typedef single_timeout combined_type; using combined_type = single_timeout;
template<typename... Ts> template<typename... Ts>
single_timeout(Ts&&... args) single_timeout(Ts&&... args)
......
...@@ -35,8 +35,11 @@ class sync_sender_impl : public Base { ...@@ -35,8 +35,11 @@ class sync_sender_impl : public Base {
public: public:
typedef response_handle<Subtype, message, ResponseHandleTag> using response_handle_type = response_handle<
response_handle_type; Subtype,
message,
ResponseHandleTag
>;
/************************************************************************** /**************************************************************************
* sync_send[_tuple](actor, ...) * * sync_send[_tuple](actor, ...) *
......
...@@ -74,7 +74,7 @@ class node_id : detail::comparable<node_id>, ...@@ -74,7 +74,7 @@ class node_id : detail::comparable<node_id>,
/** /**
* @brief Represents a 160 bit hash. * @brief Represents a 160 bit hash.
*/ */
typedef std::array<uint8_t, host_id_size> host_id_type; using host_id_type = std::array<uint8_t, host_id_size>;
/** /**
* @brief A reference counted container for host ID and process ID. * @brief A reference counted container for host ID and process ID.
......
...@@ -47,13 +47,13 @@ namespace detail { ...@@ -47,13 +47,13 @@ namespace detail {
template<bool IsFun, typename T> template<bool IsFun, typename T>
struct add_ptr_to_fun_ { struct add_ptr_to_fun_ {
typedef T* type; using type = T*;
}; };
template<typename T> template<typename T>
struct add_ptr_to_fun_<false, T> { struct add_ptr_to_fun_<false, T> {
typedef T type; using type = T;
}; };
...@@ -62,13 +62,13 @@ struct add_ptr_to_fun : add_ptr_to_fun_<std::is_function<T>::value, T> {}; ...@@ -62,13 +62,13 @@ struct add_ptr_to_fun : add_ptr_to_fun_<std::is_function<T>::value, T> {};
template<bool ToVoid, typename T> template<bool ToVoid, typename T>
struct to_void_impl { struct to_void_impl {
typedef unit_t type; using type = unit_t;
}; };
template<typename T> template<typename T>
struct to_void_impl<false, T> { struct to_void_impl<false, T> {
typedef typename add_ptr_to_fun<T>::type type; using type = typename add_ptr_to_fun<T>::type;
}; };
...@@ -137,13 +137,15 @@ struct tuple_maker { ...@@ -137,13 +137,15 @@ struct tuple_maker {
template<class Transformers, class Pattern> template<class Transformers, class Pattern>
struct rvalue_builder { struct rvalue_builder {
typedef typename detail::tl_back<Pattern>::type back_type; using back_type = typename detail::tl_back<Pattern>::type;
static constexpr bool is_complete = static constexpr bool is_complete =
!std::is_same<detail::arg_match_t, back_type>::value; !std::is_same<detail::arg_match_t, back_type>::value;
typedef typename detail::tl_apply<Transformers, std::tuple>::type using fun_container = typename detail::tl_apply<
fun_container; Transformers,
std::tuple
>::type;
fun_container m_funs; fun_container m_funs;
...@@ -161,11 +163,15 @@ struct rvalue_builder { ...@@ -161,11 +163,15 @@ struct rvalue_builder {
match_expr< match_expr<
typename get_case<is_complete, Expr, Transformers, Pattern>::type> typename get_case<is_complete, Expr, Transformers, Pattern>::type>
operator>>(Expr expr) const { operator>>(Expr expr) const {
typedef typename get_case<is_complete, Expr, Transformers, using lifted_expr = typename get_case<
Pattern>::type lifted_expr; is_complete,
Expr,
Transformers,
Pattern
>::type;
// adjust m_funs to exactly match expected projections in match case // adjust m_funs to exactly match expected projections in match case
typedef typename lifted_expr::projections_list target; using target = typename lifted_expr::projections_list;
typedef typename tl_trim<Transformers>::type trimmed_projections; using trimmed_projections = typename tl_trim<Transformers>::type;
tuple_maker f; tuple_maker f;
auto lhs = apply_args(f, get_indices(trimmed_projections{}), m_funs); auto lhs = apply_args(f, get_indices(trimmed_projections{}), m_funs);
typename tl_apply< typename tl_apply<
...@@ -186,26 +192,28 @@ struct rvalue_builder { ...@@ -186,26 +192,28 @@ struct rvalue_builder {
template<bool IsCallable, typename T> template<bool IsCallable, typename T>
struct pattern_type_ { struct pattern_type_ {
typedef detail::get_callable_trait<T> ctrait; using ctrait = detail::get_callable_trait<T>;
typedef typename ctrait::arg_types args; using args = typename ctrait::arg_types;
static_assert(detail::tl_size<args>::value == 1, static_assert(detail::tl_size<args>::value == 1,
"only unary functions allowed"); "only unary functions allowed");
typedef typename detail::rm_const_and_ref< using type = typename detail::rm_const_and_ref<
typename detail::tl_head<args>::type>::type type; typename detail::tl_head<args>::type
>::type;
}; };
template<typename T> template<typename T>
struct pattern_type_<false, T> { struct pattern_type_<false, T> {
typedef typename implicit_conversions<typename detail::rm_const_and_ref< using type = typename implicit_conversions<
typename detail::unboxed<T>::type>::type>::type type; typename detail::rm_const_and_ref<
typename detail::unboxed<T>::type
>::type
>::type;
}; };
template<typename T> template<typename T>
struct pattern_type struct pattern_type
: pattern_type_< : pattern_type_<
detail::is_callable<T>::value && !detail::is_boxed<T>::value, T> {}; detail::is_callable<T>::value && !detail::is_boxed<T>::value, T> { };
} // namespace detail } // namespace detail
} // namespace cppa } // namespace cppa
...@@ -283,7 +291,7 @@ constexpr typename detail::boxed<T>::type val() { ...@@ -283,7 +291,7 @@ constexpr typename detail::boxed<T>::type val() {
return typename detail::boxed<T>::type(); return typename detail::boxed<T>::type();
} }
typedef typename detail::boxed<detail::arg_match_t>::type boxed_arg_match_t; using boxed_arg_match_t = typename detail::boxed<detail::arg_match_t>::type;
constexpr boxed_arg_match_t arg_match = boxed_arg_match_t(); constexpr boxed_arg_match_t arg_match = boxed_arg_match_t();
...@@ -330,14 +338,17 @@ struct is_optional<optional<T>> : std::true_type {}; ...@@ -330,14 +338,17 @@ struct is_optional<optional<T>> : std::true_type {};
template<typename T> template<typename T>
struct to_guard<T, true> { struct to_guard<T, true> {
typedef typename detail::get_callable_trait<T>::type ct; using ct = typename detail::get_callable_trait<T>::type;
typedef typename ct::arg_types arg_types; using arg_types = typename ct::arg_types;
static_assert(detail::tl_size<arg_types>::value == 1, static_assert(detail::tl_size<arg_types>::value == 1,
"projection/guard must take exactly one argument"); "projection/guard must take exactly one argument");
static_assert(is_optional<typename ct::result_type>::value, static_assert(is_optional<typename ct::result_type>::value,
"projection/guard must return an optional value"); "projection/guard must return an optional value");
typedef typename std::conditional<std::is_function<T>::value, T*, T>::type using value_type = typename std::conditional<
value_type; std::is_function<T>::value,
T*,
T
>::type;
static value_type _(value_type val) { return val; } static value_type _(value_type val) { return val; }
}; };
...@@ -414,8 +425,12 @@ class on_the_fly_rvalue_builder { ...@@ -414,8 +425,12 @@ class on_the_fly_rvalue_builder {
match_expr<typename get_case<false, Expr, detail::empty_type_list, match_expr<typename get_case<false, Expr, detail::empty_type_list,
detail::empty_type_list>::type> detail::empty_type_list>::type>
operator>>(Expr expr) const { operator>>(Expr expr) const {
typedef typename get_case<false, Expr, detail::empty_type_list, using result_type = typename get_case<
detail::empty_type_list>::type result_type; false,
Expr,
detail::empty_type_list,
detail::empty_type_list
>::type;
return result_type{std::move(expr)}; return result_type{std::move(expr)};
} }
......
...@@ -39,13 +39,13 @@ namespace detail { ...@@ -39,13 +39,13 @@ namespace detail {
// converts C arrays, i.e., pointers, to vectors // converts C arrays, i.e., pointers, to vectors
template<typename T> template<typename T>
struct carr_to_vec { struct carr_to_vec {
typedef T type; using type = T;
}; };
template<typename T> template<typename T>
struct carr_to_vec<T*> { struct carr_to_vec<T*> {
typedef std::vector<T> type; using type = std::vector<T>;
}; };
...@@ -146,8 +146,8 @@ spawn_cl(const opencl::program& prog, const char* fname, MapArgs map_args, ...@@ -146,8 +146,8 @@ spawn_cl(const opencl::program& prog, const char* fname, MapArgs map_args,
const opencl::dim_vec& offset = {}, const opencl::dim_vec& offset = {},
const opencl::dim_vec& local_dims = {}, size_t result_size = 0) { const opencl::dim_vec& local_dims = {}, size_t result_size = 0) {
using std::move; using std::move;
typedef typename util::get_callable_trait<MapArgs>::fun_type f0; using f0 = typename util::get_callable_trait<MapArgs>::fun_type;
typedef typename util::get_callable_trait<MapResult>::fun_type f1; using f1 = typename util::get_callable_trait<MapResult>::fun_type;
detail::cl_spawn_helper<f0, f1> f; detail::cl_spawn_helper<f0, f1> f;
return f(f0{move(map_args)}, f1{move(map_result)}, prog, fname, dims, return f(f0{move(map_args)}, f1{move(map_result)}, prog, fname, dims,
offset, local_dims, result_size); offset, local_dims, result_size);
......
...@@ -68,11 +68,10 @@ class actor_facade<Ret(Args...)> : public abstract_actor { ...@@ -68,11 +68,10 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
public: public:
typedef cow_tuple<typename detail::rm_const_and_ref<Args>::type...> using args_tuple = cow_tuple<typename detail::rm_const_and_ref<Args>::type...>;
args_tuple;
typedef std::function<optional<args_tuple>(message)> arg_mapping; using arg_mapping = std::function<optional<args_tuple>(message)>;
typedef std::function<message(Ret&)> result_mapping; using result_mapping = std::function<message(Ret&)>;
static intrusive_ptr<actor_facade> static intrusive_ptr<actor_facade>
create(const program& prog, const char* kernel_name, create(const program& prog, const char* kernel_name,
......
...@@ -48,7 +48,7 @@ namespace opencl { ...@@ -48,7 +48,7 @@ namespace opencl {
/** /**
* @brief A vector of up to three elements used for OpenCL dimensions. * @brief A vector of up to three elements used for OpenCL dimensions.
*/ */
typedef detail::limited_vector<size_t, 3> dim_vec; using dim_vec = detail::limited_vector<size_t, 3>;
std::string get_opencl_error(cl_int err); std::string get_opencl_error(cl_int err);
......
...@@ -42,12 +42,12 @@ namespace opencl { ...@@ -42,12 +42,12 @@ namespace opencl {
template<typename T, cl_int (*ref)(T), cl_int (*deref)(T)> template<typename T, cl_int (*ref)(T), cl_int (*deref)(T)>
class smart_ptr { class smart_ptr {
typedef typename std::remove_pointer<T>::type element_type; using element_type = typename std::remove_pointer<T>::type;
typedef element_type* pointer; using pointer = element_type* ;
typedef element_type& reference; using reference = element_type& ;
typedef const element_type* const_pointer; using const_pointer = const element_type*;
typedef const element_type& const_reference; using const_reference = const element_type&;
public: public:
...@@ -110,11 +110,11 @@ class smart_ptr { ...@@ -110,11 +110,11 @@ class smart_ptr {
}; };
typedef smart_ptr<cl_mem, clRetainMemObject, clReleaseMemObject> mem_ptr; using mem_ptr = smart_ptr<cl_mem, clRetainMemObject, clReleaseMemObject>;
typedef smart_ptr<cl_event, clRetainEvent, clReleaseEvent> event_ptr; using event_ptr = smart_ptr<cl_event, clRetainEvent, clReleaseEvent> ;
typedef smart_ptr<cl_kernel, clRetainKernel, clReleaseKernel> kernel_ptr; using kernel_ptr = smart_ptr<cl_kernel, clRetainKernel, clReleaseKernel> ;
typedef smart_ptr<cl_context, clRetainContext, clReleaseContext> context_ptr; using context_ptr = smart_ptr<cl_context, clRetainContext, clReleaseContext>;
typedef smart_ptr<cl_program, clRetainProgram, clReleaseProgram> program_ptr; using program_ptr = smart_ptr<cl_program, clRetainProgram, clReleaseProgram>;
typedef smart_ptr<cl_device_id, clRetainDeviceDummy, clReleaseDeviceDummy> typedef smart_ptr<cl_device_id, clRetainDeviceDummy, clReleaseDeviceDummy>
device_ptr; device_ptr;
typedef smart_ptr<cl_command_queue, clRetainCommandQueue, clReleaseCommandQueue> typedef smart_ptr<cl_command_queue, clRetainCommandQueue, clReleaseCommandQueue>
......
...@@ -40,7 +40,7 @@ class optional { ...@@ -40,7 +40,7 @@ class optional {
/** /**
* @brief Typdef for @p T. * @brief Typdef for @p T.
*/ */
typedef T type; using type = T;
/* * /* *
* @brief Default constructor. * @brief Default constructor.
...@@ -199,7 +199,7 @@ class optional<T&> { ...@@ -199,7 +199,7 @@ class optional<T&> {
public: public:
typedef T type; using type = T;
optional(const none_t& = none) : m_value(nullptr) { } optional(const none_t& = none) : m_value(nullptr) { }
......
...@@ -66,10 +66,17 @@ struct option_info { ...@@ -66,10 +66,17 @@ struct option_info {
/** /**
* @brief Stores a help text for program options with option groups. * @brief Stores a help text for program options with option groups.
*/ */
typedef std::map<std::string, std::map<std::pair<char, std::string>, option_info>> using options_description = std::map<
options_description; std::string,
std::map<
using opt_rvalue_builder = decltype(on(std::function<optional<std::string> (const std::string&)>{}) || on(std::string{}, val<std::string>)); std::pair<char, std::string>,
option_info
>
>;
using opt_rvalue_builder = decltype( on(std::function<optional<std::string>
(const std::string&)>{})
|| on(std::string{}, val<std::string>));
using opt0_rvalue_builder = decltype(on(std::string{}) || on(std::string{})); using opt0_rvalue_builder = decltype(on(std::string{}) || on(std::string{}));
......
...@@ -60,7 +60,7 @@ enum handle_message_result { ...@@ -60,7 +60,7 @@ enum handle_message_result {
template<receive_policy_flag X> template<receive_policy_flag X>
struct rp_flag { struct rp_flag {
typedef std::integral_constant<receive_policy_flag, X> type; using type = std::integral_constant<receive_policy_flag, X>;
}; };
/** /**
...@@ -103,9 +103,9 @@ class invoke_policy { ...@@ -103,9 +103,9 @@ class invoke_policy {
return result; return result;
} }
typedef typename rp_flag<rp_nestable>::type nestable; using nestable = typename rp_flag<rp_nestable>::type;
typedef typename rp_flag<rp_sequential>::type sequential; using sequential = typename rp_flag<rp_sequential>::type;
private: private:
......
...@@ -42,7 +42,7 @@ class middleman_scheduling { ...@@ -42,7 +42,7 @@ class middleman_scheduling {
public: public:
typedef intrusive_ptr<Actor> pointer; using pointer = intrusive_ptr<Actor>;
continuation(pointer ptr, msg_hdr_cref hdr, message&& msg) continuation(pointer ptr, msg_hdr_cref hdr, message&& msg)
: m_self(std::move(ptr)), m_hdr(hdr), m_data(std::move(msg)) { } : m_self(std::move(ptr)), m_hdr(hdr), m_data(std::move(msg)) { }
......
...@@ -41,11 +41,11 @@ namespace policy { ...@@ -41,11 +41,11 @@ namespace policy {
class no_scheduling { class no_scheduling {
typedef std::unique_lock<std::mutex> lock_type; using lock_type = std::unique_lock<std::mutex>;
public: public:
typedef std::chrono::high_resolution_clock::time_point timeout_type; using timeout_type = std::chrono::high_resolution_clock::time_point;
template<class Actor> template<class Actor>
void enqueue(Actor* self, const actor_addr& sender, message_id mid, void enqueue(Actor* self, const actor_addr& sender, message_id mid,
......
...@@ -33,9 +33,9 @@ class not_prioritizing { ...@@ -33,9 +33,9 @@ class not_prioritizing {
public: public:
typedef std::list<unique_mailbox_element_pointer> cache_type; using cache_type = std::list<unique_mailbox_element_pointer>;
typedef cache_type::iterator cache_iterator; using cache_iterator = cache_type::iterator;
template<class Actor> template<class Actor>
unique_mailbox_element_pointer next_message(Actor* self) { unique_mailbox_element_pointer next_message(Actor* self) {
......
...@@ -28,10 +28,10 @@ class policies { ...@@ -28,10 +28,10 @@ class policies {
public: public:
typedef SchedulingPolicy scheduling_policy; using scheduling_policy = SchedulingPolicy;
typedef PriorityPolicy priority_policy; using priority_policy = PriorityPolicy;
typedef ResumePolicy resume_policy; using resume_policy = ResumePolicy;
typedef InvokePolicy invoke_policy; using invoke_policy = InvokePolicy;
scheduling_policy& get_scheduling_policy() { return m_scheduling_policy; } scheduling_policy& get_scheduling_policy() { return m_scheduling_policy; }
......
...@@ -33,9 +33,9 @@ class prioritizing { ...@@ -33,9 +33,9 @@ class prioritizing {
public: public:
typedef std::list<unique_mailbox_element_pointer> cache_type; using cache_type = std::list<unique_mailbox_element_pointer>;
typedef cache_type::iterator cache_iterator; using cache_iterator = cache_type::iterator;
template<class Actor> template<class Actor>
unique_mailbox_element_pointer next_message(Actor* self) { unique_mailbox_element_pointer next_message(Actor* self) {
......
...@@ -50,9 +50,9 @@ class priority_policy { ...@@ -50,9 +50,9 @@ class priority_policy {
void push_to_cache(unique_mailbox_element_pointer ptr); void push_to_cache(unique_mailbox_element_pointer ptr);
typedef std::vector<unique_mailbox_element_pointer> cache_type; using cache_type = std::vector<unique_mailbox_element_pointer>;
typedef cache_type::iterator cache_iterator; using cache_iterator = cache_type::iterator;
cache_iterator cache_begin(); cache_iterator cache_begin();
......
...@@ -42,7 +42,7 @@ class scheduling_policy { ...@@ -42,7 +42,7 @@ class scheduling_policy {
public: public:
/** /**
* @brief This typedef can be set freely by any implementation and is * @brief This type can be set freely by any implementation and is
* used by callers to pass the result of @p init_timeout back to * used by callers to pass the result of @p init_timeout back to
* @p fetch_messages. * @p fetch_messages.
*/ */
......
...@@ -32,9 +32,23 @@ ...@@ -32,9 +32,23 @@
namespace cppa { namespace cppa {
typedef variant<int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, using primitive_variant = variant<
uint64_t, float, double, long double, std::string, int8_t,
std::u16string, std::u32string, atom_value> primitive_variant; int16_t,
int32_t,
int64_t,
uint8_t,
uint16_t,
uint32_t,
uint64_t,
float,
double,
long double,
std::string,
std::u16string,
std::u32string,
atom_value
>;
} // namespace cppa } // namespace cppa
......
...@@ -35,7 +35,7 @@ class actor_widget_mixin : public Base { ...@@ -35,7 +35,7 @@ class actor_widget_mixin : public Base {
public: public:
typedef typename actor_companion::message_pointer message_pointer; using message_pointer = typename actor_companion::message_pointer;
struct event_type : public QEvent { struct event_type : public QEvent {
......
...@@ -27,8 +27,8 @@ template<typename... Is> ...@@ -27,8 +27,8 @@ template<typename... Is>
struct replies_to { struct replies_to {
template<typename... Os> template<typename... Os>
struct with { struct with {
typedef detail::type_list<Is...> input_types; using input_types = detail::type_list<Is...>;
typedef detail::type_list<Os...> output_types; using output_types = detail::type_list<Os...>;
}; };
}; };
......
...@@ -192,7 +192,7 @@ class response_handle<Self, detail::type_list<Ts...>, ...@@ -192,7 +192,7 @@ class response_handle<Self, detail::type_list<Ts...>,
public: public:
typedef detail::type_list<Ts...> result_types; using result_types = detail::type_list<Ts...>;
response_handle() = delete; response_handle() = delete;
...@@ -202,14 +202,17 @@ class response_handle<Self, detail::type_list<Ts...>, ...@@ -202,14 +202,17 @@ class response_handle<Self, detail::type_list<Ts...>,
template<typename F> template<typename F>
void await(F fun) { void await(F fun) {
typedef typename detail::tl_map< using arg_types = typename detail::tl_map<
typename detail::get_callable_trait<F>::arg_types, typename detail::get_callable_trait<F>::arg_types,
detail::rm_const_and_ref>::type arg_types; detail::rm_const_and_ref
>::type;
static constexpr size_t fun_args = detail::tl_size<arg_types>::value; static constexpr size_t fun_args = detail::tl_size<arg_types>::value;
static_assert(fun_args <= detail::tl_size<result_types>::value, static_assert(fun_args <= detail::tl_size<result_types>::value,
"functor takes too much arguments"); "functor takes too much arguments");
typedef typename detail::tl_right<result_types, fun_args>::type using recv_types = typename detail::tl_right<
recv_types; result_types,
fun_args
>::type;
static_assert(std::is_same<arg_types, recv_types>::value, static_assert(std::is_same<arg_types, recv_types>::value,
"wrong functor signature"); "wrong functor signature");
behavior tmp = detail::fs2bhvr(m_self, fun); behavior tmp = detail::fs2bhvr(m_self, fun);
......
...@@ -40,7 +40,7 @@ class sb_actor : public Base { ...@@ -40,7 +40,7 @@ class sb_actor : public Base {
protected: protected:
typedef sb_actor combined_type; using combined_type = sb_actor;
public: public:
......
...@@ -82,9 +82,9 @@ class worker : public execution_unit { ...@@ -82,9 +82,9 @@ class worker : public execution_unit {
worker& operator=(const worker&) = delete; worker& operator=(const worker&) = delete;
typedef resumable* job_ptr; using job_ptr = resumable*;
typedef detail::producer_consumer_list<resumable> job_queue; using job_queue = detail::producer_consumer_list<resumable>;
/** /**
* @brief Attempt to steal an element from the exposed job queue. * @brief Attempt to steal an element from the exposed job queue.
......
...@@ -33,11 +33,11 @@ namespace cppa { ...@@ -33,11 +33,11 @@ namespace cppa {
template<class Base, class Subtype> template<class Base, class Subtype>
class single_timeout : public Base { class single_timeout : public Base {
typedef Base super; using super = Base;
public: public:
typedef single_timeout combined_type; using combined_type = single_timeout;
template<typename... Ts> template<typename... Ts>
single_timeout(Ts&&... args) single_timeout(Ts&&... args)
......
...@@ -88,7 +88,7 @@ struct spawn_fwd { ...@@ -88,7 +88,7 @@ struct spawn_fwd {
template<typename T, typename... Ts> template<typename T, typename... Ts>
struct spawn_fwd<T(Ts...)> { struct spawn_fwd<T(Ts...)> {
typedef T (*fun_pointer)(Ts...); using fun_pointer = T (*)(Ts...);
static inline fun_pointer fwd(fun_pointer arg) { return arg; } static inline fun_pointer fwd(fun_pointer arg) { return arg; }
}; };
...@@ -114,9 +114,9 @@ intrusive_ptr<C> spawn_class(execution_unit* eu, BeforeLaunch before_launch_fun, ...@@ -114,9 +114,9 @@ intrusive_ptr<C> spawn_class(execution_unit* eu, BeforeLaunch before_launch_fun,
template<spawn_options Os, typename BeforeLaunch, typename F, typename... Ts> template<spawn_options Os, typename BeforeLaunch, typename F, typename... Ts>
actor spawn_functor(execution_unit* eu, BeforeLaunch cb, F fun, Ts&&... args) { actor spawn_functor(execution_unit* eu, BeforeLaunch cb, F fun, Ts&&... args) {
typedef typename detail::get_callable_trait<F>::type trait; using trait = typename detail::get_callable_trait<F>::type;
typedef typename trait::arg_types arg_types; using arg_types = typename trait::arg_types;
typedef typename detail::tl_head<arg_types>::type first_arg; using first_arg = typename detail::tl_head<arg_types>::type;
using base_class = typename std::conditional< using base_class = typename std::conditional<
std::is_pointer<first_arg>::value, std::is_pointer<first_arg>::value,
typename std::remove_pointer<first_arg>::type, typename std::remove_pointer<first_arg>::type,
...@@ -199,22 +199,22 @@ namespace detail { ...@@ -199,22 +199,22 @@ namespace detail {
template<typename... Rs> template<typename... Rs>
class functor_based_typed_actor : public typed_event_based_actor<Rs...> { class functor_based_typed_actor : public typed_event_based_actor<Rs...> {
typedef typed_event_based_actor<Rs...> super; using super = typed_event_based_actor<Rs...>;
public: public:
typedef typed_event_based_actor<Rs...>* pointer; using pointer = typed_event_based_actor<Rs...>*;
typedef typename super::behavior_type behavior_type; using behavior_type = typename super::behavior_type;
typedef std::function<behavior_type()> no_arg_fun; using no_arg_fun = std::function<behavior_type()>;
typedef std::function<behavior_type(pointer)> one_arg_fun1; using one_arg_fun1 = std::function<behavior_type(pointer)>;
typedef std::function<void(pointer)> one_arg_fun2; using one_arg_fun2 = std::function<void(pointer)>;
template<typename F, typename... Ts> template<typename F, typename... Ts>
functor_based_typed_actor(F fun, Ts&&... args) { functor_based_typed_actor(F fun, Ts&&... args) {
typedef typename detail::get_callable_trait<F>::type trait; using trait = typename detail::get_callable_trait<F>::type;
typedef typename trait::arg_types arg_types; using arg_types = typename trait::arg_types;
typedef typename trait::result_type result_type; using result_type = typename trait::result_type;
constexpr bool returns_behavior = constexpr bool returns_behavior =
std::is_same<result_type, behavior_type>::value; std::is_same<result_type, behavior_type>::value;
constexpr bool uses_first_arg = std::is_same< constexpr bool uses_first_arg = std::is_same<
...@@ -276,13 +276,13 @@ struct infer_typed_actor_base; ...@@ -276,13 +276,13 @@ struct infer_typed_actor_base;
template<typename... Rs, class FirstArg> template<typename... Rs, class FirstArg>
struct infer_typed_actor_base<typed_behavior<Rs...>, FirstArg> { struct infer_typed_actor_base<typed_behavior<Rs...>, FirstArg> {
typedef functor_based_typed_actor<Rs...> type; using type = functor_based_typed_actor<Rs...>;
}; };
template<typename... Rs> template<typename... Rs>
struct infer_typed_actor_base<void, typed_event_based_actor<Rs...>*> { struct infer_typed_actor_base<void, typed_event_based_actor<Rs...>*> {
typedef functor_based_typed_actor<Rs...> type; using type = functor_based_typed_actor<Rs...>;
}; };
...@@ -308,10 +308,12 @@ typename detail::infer_typed_actor_handle< ...@@ -308,10 +308,12 @@ typename detail::infer_typed_actor_handle<
typename detail::tl_head< typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types>::type>::type typename detail::get_callable_trait<F>::arg_types>::type>::type
spawn_typed_functor(execution_unit* eu, BeforeLaunch bl, F fun, Ts&&... args) { spawn_typed_functor(execution_unit* eu, BeforeLaunch bl, F fun, Ts&&... args) {
typedef typename detail::infer_typed_actor_base< using impl = typename detail::infer_typed_actor_base<
typename detail::get_callable_trait<F>::result_type, typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<typename detail::get_callable_trait< typename detail::tl_head<
F>::arg_types>::type>::type impl; typename detail::get_callable_trait<F>::arg_types
>::type
>::type;
return spawn_class<impl, Os>(eu, bl, fun, std::forward<Ts>(args)...); return spawn_class<impl, Os>(eu, bl, fun, std::forward<Ts>(args)...);
} }
......
...@@ -81,14 +81,14 @@ struct infer_typed_actor_handle; ...@@ -81,14 +81,14 @@ struct infer_typed_actor_handle;
// infer actor type from result type if possible // infer actor type from result type if possible
template<typename... Rs, class FirstArg> template<typename... Rs, class FirstArg>
struct infer_typed_actor_handle<typed_behavior<Rs...>, FirstArg> { struct infer_typed_actor_handle<typed_behavior<Rs...>, FirstArg> {
typedef typed_actor<Rs...> type; using type = typed_actor<Rs...>;
}; };
// infer actor type from first argument if result type is void // infer actor type from first argument if result type is void
template<typename... Rs> template<typename... Rs>
struct infer_typed_actor_handle<void, typed_event_based_actor<Rs...>*> { struct infer_typed_actor_handle<void, typed_event_based_actor<Rs...>*> {
typedef typed_actor<Rs...> type; using type = typed_actor<Rs...>;
}; };
...@@ -97,7 +97,7 @@ struct actor_handle_from_signature_list; ...@@ -97,7 +97,7 @@ struct actor_handle_from_signature_list;
template<typename... Rs> template<typename... Rs>
struct actor_handle_from_signature_list<detail::type_list<Rs...>> { struct actor_handle_from_signature_list<detail::type_list<Rs...>> {
typedef typed_actor<Rs...> type; using type = typed_actor<Rs...>;
}; };
......
...@@ -93,7 +93,7 @@ typename std::enable_if< ...@@ -93,7 +93,7 @@ typename std::enable_if<
bool bool
>::type >::type
safe_equal(const T& lhs, const U& rhs) { safe_equal(const T& lhs, const U& rhs) {
typedef decltype(lhs - rhs) res_type; using res_type = decltype(lhs - rhs);
return std::fabs(lhs - rhs) <= std::numeric_limits<res_type>::epsilon(); return std::fabs(lhs - rhs) <= std::numeric_limits<res_type>::epsilon();
} }
......
...@@ -38,7 +38,7 @@ struct timeout_definition { ...@@ -38,7 +38,7 @@ struct timeout_definition {
}; };
typedef timeout_definition<std::function<void()>> generic_timeout_definition; using generic_timeout_definition = timeout_definition<std::function<void()>>;
} // namespace cppa } // namespace cppa
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011 - 2014 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the Boost Software License, Version 1.0. See *
* accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt *
\******************************************************************************/
#ifndef CPPA_TPARTIAL_FUNCTION_HPP
#define CPPA_TPARTIAL_FUNCTION_HPP
#include <cstddef>
#include <type_traits>
#include "cppa/none.hpp"
#include "cppa/unit.hpp"
#include "cppa/optional.hpp"
#include "cppa/lift_void.hpp"
#include "cppa/util/call.hpp"
#include "cppa/util/type_list.hpp"
#include "cppa/util/type_traits.hpp"
#include "cppa/util/left_or_right.hpp"
namespace cppa {
template<typename Result, typename... Ts>
struct tpartial_function_helper {
template<typename Fun>
inline optional<Result> operator()(const Fun& fun, Ts... args) {
if (fun.defined_at(args...)) return fun.invoke(args...);
return none;
}
template<class Expr, class Tuple, class Indices>
inline Result lifted_result(Expr& expr, Tuple& tup, Indices& indices) {
return util::apply_args(expr, tup, indices);
}
};
template<typename... Ts>
struct tpartial_function_helper<unit_t, Ts...> {
template<typename Fun>
inline optional<unit_t> operator()(const Fun& fun, Ts... args) {
if (fun.defined_at(args...)) {
fun.invoke(args...);
return unit;
}
return none;
}
template<class Expr, class Tuple, class Indices>
inline unit_t lifted_result(Expr& expr, Tuple& tup, Indices& indices) {
util::apply_args(expr, tup, indices);
return unit;
}
};
template<class Expr, class Guard, typename Result, typename... Ts>
class tpartial_function {
typedef typename util::get_callable_trait<Expr>::type ctrait;
typedef typename ctrait::arg_types ctrait_args;
static constexpr size_t num_expr_args = util::tl_size<ctrait_args>::value;
static_assert(util::tl_exists<detail::type_list<Ts...>,
std::is_rvalue_reference >::value == false,
"partial functions using rvalue arguments are not supported");
public:
typedef detail::type_list<Ts...> arg_types;
typedef Guard guard_type;
static constexpr size_t num_arguments = sizeof...(Ts);
static constexpr bool manipulates_args =
util::tl_exists<arg_types, util::is_mutable_ref>::value;
typedef typename lift_void<Result>::type result_type;
template<typename Fun, typename... G>
tpartial_function(Fun&& fun, G&&... guard_args)
: m_guard(std::forward<G>(guard_args)...)
, m_expr(std::forward<Fun>(fun)) {
}
tpartial_function(tpartial_function&& other)
: m_guard(std::move(other.m_guard))
, m_expr(std::move(other.m_expr)) {
}
tpartial_function(const tpartial_function&) = default;
inline bool defined_at(Ts... args) const {
return m_guard(args...);
}
/**
* @brief Invokes the function without evaluating the guard.
*/
result_type invoke(Ts... args) const {
auto targs = std::forward_as_tuple(args...);
auto indices = util::get_right_indices<num_expr_args>(targs);
tpartial_function_helper<result_type, Ts...> helper;
return helper.lifted_result(m_expr, targs, indices);
}
inline optional<result_type> operator()(Ts... args) const {
tpartial_function_helper<result_type, Ts...> helper;
return helper(*this, args...);
}
private:
Guard m_guard;
Expr m_expr;
};
template<class Expr, class Guard, typename Ts,
typename Result = unit_t, size_t Step = 0>
struct get_tpartial_function;
template<class Expr, class Guard, typename... Ts, typename Result>
struct get_tpartial_function<Expr, Guard, detail::type_list<Ts...>, Result, 1> {
typedef tpartial_function<Expr, Guard, Result, Ts...> type;
};
template<class Expr, class Guard, typename... Ts>
struct get_tpartial_function<Expr, Guard,
detail::type_list<Ts...>, unit_t, 0> {
typedef typename util::get_callable_trait<Expr>::type ctrait;
typedef typename ctrait::arg_types arg_types;
static_assert(util::tl_size<arg_types>::value <= sizeof...(Ts),
"Functor takes too much arguments");
typedef typename get_tpartial_function<
Expr,
Guard,
// fill arg_types of Expr from left with const Ts&
typename util::tl_zip<
typename util::tl_pad_left<
typename ctrait::arg_types,
sizeof...(Ts)
>::type,
detail::type_list<const Ts&...>,
util::left_or_right
>::type,
typename ctrait::result_type,
1
>::type
type;
};
} // namespace cppa
#endif // CPPA_TPARTIAL_FUNCTION_HPP
...@@ -63,22 +63,22 @@ class typed_actor ...@@ -63,22 +63,22 @@ class typed_actor
* @brief Identifies the behavior type actors of this kind use * @brief Identifies the behavior type actors of this kind use
* for their behavior stack. * for their behavior stack.
*/ */
typedef typed_behavior<Rs...> behavior_type; using behavior_type = typed_behavior<Rs...>;
/** /**
* @brief Identifies pointers to instances of this kind of actor. * @brief Identifies pointers to instances of this kind of actor.
*/ */
typedef typed_event_based_actor<Rs...>* pointer; using pointer = typed_event_based_actor<Rs...>*;
/** /**
* @brief Identifies the base class for this kind of actor. * @brief Identifies the base class for this kind of actor.
*/ */
typedef typed_event_based_actor<Rs...> base; using base = typed_event_based_actor<Rs...>;
/** /**
* @brief Stores the interface of the actor as type list. * @brief Stores the interface of the actor as type list.
*/ */
typedef detail::type_list<Rs...> interface; using interface = detail::type_list<Rs...>;
typed_actor() = default; typed_actor() = default;
typed_actor(typed_actor&&) = default; typed_actor(typed_actor&&) = default;
......
...@@ -39,23 +39,23 @@ struct input_only; ...@@ -39,23 +39,23 @@ struct input_only;
template<typename... Ts> template<typename... Ts>
struct input_only<detail::type_list<Ts...>> { struct input_only<detail::type_list<Ts...>> {
typedef detail::type_list<typename Ts::input_types...> type; using type = detail::type_list<typename Ts::input_types...>;
}; };
typedef detail::type_list<skip_message_t> skip_list; using skip_list = detail::type_list<skip_message_t>;
template<class List> template<class List>
struct unbox_typed_continue_helper { struct unbox_typed_continue_helper {
// do nothing if List is actually a list, i.e., not a typed_continue_helper // do nothing if List is actually a list, i.e., not a typed_continue_helper
typedef List type; using type = List;
}; };
template<class List> template<class List>
struct unbox_typed_continue_helper< struct unbox_typed_continue_helper<
detail::type_list<typed_continue_helper<List>>> { detail::type_list<typed_continue_helper<List>>> {
typedef List type; using type = List;
}; };
...@@ -64,7 +64,7 @@ struct same_input : std::is_same<Input, typename RepliesToWith::input_types> {}; ...@@ -64,7 +64,7 @@ struct same_input : std::is_same<Input, typename RepliesToWith::input_types> {};
template<class Output, class RepliesToWith> template<class Output, class RepliesToWith>
struct same_output_or_skip_message_t { struct same_output_or_skip_message_t {
typedef typename RepliesToWith::output_types other; 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_message_t>>::value; std::is_same<Output, type_list<skip_message_t>>::value;
...@@ -75,13 +75,15 @@ template<typename SList> ...@@ -75,13 +75,15 @@ template<typename SList>
struct valid_input_predicate { struct valid_input_predicate {
template<typename Expr> template<typename Expr>
struct inner { struct inner {
typedef typename Expr::input_types input_types; using input_types = typename Expr::input_types;
typedef typename unbox_typed_continue_helper< using output_types = typename unbox_typed_continue_helper<
typename Expr::output_types>::type output_types; typename Expr::output_types
>::type;
// get matching elements for input type // get matching elements for input type
typedef typename tl_filter< using filtered_slist = typename tl_filter<
SList, tbind<same_input, input_types>::template type>::type SList,
filtered_slist; tbind<same_input, input_types>::template type
>::type;
static_assert(tl_size<filtered_slist>::value > 0, static_assert(tl_size<filtered_slist>::value > 0,
"cannot assign given match expression to " "cannot assign given match expression to "
"typed behavior, because the expression " "typed behavior, because the expression "
...@@ -160,7 +162,7 @@ class typed_behavior { ...@@ -160,7 +162,7 @@ class typed_behavior {
typed_behavior& operator=(typed_behavior&&) = default; typed_behavior& operator=(typed_behavior&&) = default;
typed_behavior& operator=(const typed_behavior&) = default; typed_behavior& operator=(const typed_behavior&) = default;
typedef detail::type_list<Rs...> signatures; using signatures = detail::type_list<Rs...>;
template<typename T, typename... Ts> template<typename T, typename... Ts>
typed_behavior(T arg, Ts&&... args) { typed_behavior(T arg, Ts&&... args) {
...@@ -197,8 +199,11 @@ class typed_behavior { ...@@ -197,8 +199,11 @@ class typed_behavior {
template<typename... Cs> template<typename... Cs>
void set(match_expr<Cs...>&& expr) { void set(match_expr<Cs...>&& expr) {
// do some transformation before type-checking the input signatures // do some transformation before type-checking the input signatures
typedef typename detail::tl_map<detail::type_list< using input = typename detail::tl_map<
typename detail::deduce_signature<Cs>::type...>>::type input; detail::type_list<
typename detail::deduce_signature<Cs>::type...
>
>::type;
// check types // check types
detail::static_check_typed_behavior_input<signatures, input>(); detail::static_check_typed_behavior_input<signatures, input>();
// final (type-erasure) step // final (type-erasure) step
......
...@@ -32,7 +32,7 @@ class typed_continue_helper { ...@@ -32,7 +32,7 @@ class typed_continue_helper {
public: public:
typedef int message_id_wrapper_tag; using message_id_wrapper_tag = int;
typed_continue_helper(message_id mid, local_actor* self) typed_continue_helper(message_id mid, local_actor* self)
: m_ch(mid, self) {} : m_ch(mid, self) {}
......
...@@ -50,9 +50,9 @@ class typed_event_based_actor ...@@ -50,9 +50,9 @@ class typed_event_based_actor
typed_event_based_actor() : m_initialized(false) {} typed_event_based_actor() : m_initialized(false) {}
typedef detail::type_list<Rs...> signatures; using signatures = detail::type_list<Rs...>;
typedef typed_behavior<Rs...> behavior_type; using behavior_type = typed_behavior<Rs...>;
std::set<std::string> interface() const override { std::set<std::string> interface() const override {
return {detail::to_uniform_name<Rs>()...}; return {detail::to_uniform_name<Rs>()...};
......
...@@ -44,7 +44,7 @@ const uniform_type_info* uniform_typeid(const std::type_info&); ...@@ -44,7 +44,7 @@ const uniform_type_info* uniform_typeid(const std::type_info&);
struct uniform_value_t; struct uniform_value_t;
typedef std::unique_ptr<uniform_value_t> uniform_value; using uniform_value = std::unique_ptr<uniform_value_t>;
struct uniform_value_t { struct uniform_value_t {
const uniform_type_info* ti; const uniform_type_info* ti;
...@@ -274,7 +274,7 @@ class uniform_type_info { ...@@ -274,7 +274,7 @@ class uniform_type_info {
}; };
typedef std::unique_ptr<uniform_type_info> uniform_type_info_ptr; using uniform_type_info_ptr = std::unique_ptr<uniform_type_info>;
/** /**
* @relates uniform_type_info * @relates uniform_type_info
......
...@@ -33,25 +33,25 @@ static constexpr unit_t unit = unit_t{}; ...@@ -33,25 +33,25 @@ static constexpr unit_t unit = unit_t{};
template<typename T> template<typename T>
struct lift_void { struct lift_void {
typedef T type; using type = T;
}; };
template<> template<>
struct lift_void<void> { struct lift_void<void> {
typedef unit_t type; using type = unit_t;
}; };
template<typename T> template<typename T>
struct unlift_void { struct unlift_void {
typedef T type; using type = T;
}; };
template<> template<>
struct unlift_void<unit_t> { struct unlift_void<unit_t> {
typedef void type; using type = void;
}; };
......
...@@ -16,12 +16,11 @@ struct shutdown_request { }; ...@@ -16,12 +16,11 @@ struct shutdown_request { };
struct plus_request { int a; int b; }; struct plus_request { int a; int b; };
struct minus_request { int a; int b; }; struct minus_request { int a; int b; };
typedef typed_actor< using calculator_type = typed_actor<
replies_to<plus_request>::with<int>, replies_to<plus_request>::with<int>,
replies_to<minus_request>::with<int>, replies_to<minus_request>::with<int>,
replies_to<shutdown_request>::with<void> replies_to<shutdown_request>::with<void>
> >;
calculator_type;
calculator_type::behavior_type typed_calculator(calculator_type::pointer self) { calculator_type::behavior_type typed_calculator(calculator_type::pointer self) {
return { return {
......
...@@ -11,7 +11,7 @@ class ChatWidget : public cppa::actor_widget_mixin<QWidget> { ...@@ -11,7 +11,7 @@ class ChatWidget : public cppa::actor_widget_mixin<QWidget> {
Q_OBJECT Q_OBJECT
typedef cppa::actor_widget_mixin<QWidget> super; using super = cppa::actor_widget_mixin<QWidget>;
public: public:
......
...@@ -26,10 +26,10 @@ bool operator==(const foo& lhs, const foo& rhs) { ...@@ -26,10 +26,10 @@ bool operator==(const foo& lhs, const foo& rhs) {
} }
// a pair of two ints // a pair of two ints
typedef std::pair<int, int> foo_pair; using foo_pair = std::pair<int, int>;
// another pair of two ints // another pair of two ints
typedef std::pair<int, int> foo_pair2; using foo_pair2 = std::pair<int, int>;
// a struct with member vector<vector<...>> // a struct with member vector<vector<...>>
struct foo2 { struct foo2 {
......
...@@ -42,9 +42,9 @@ bool operator==(const foo& lhs, const foo& rhs) { ...@@ -42,9 +42,9 @@ bool operator==(const foo& lhs, const foo& rhs) {
} }
// a member function pointer to get an attribute of foo // a member function pointer to get an attribute of foo
typedef int (foo::*foo_getter)() const; using foo_getter = int (foo::*)() const;
// a member function pointer to set an attribute of foo // a member function pointer to set an attribute of foo
typedef void (foo::*foo_setter)(int); using foo_setter = void (foo::*)(int);
void testee(event_based_actor* self) { void testee(event_based_actor* self) {
self->become ( self->become (
......
...@@ -130,7 +130,7 @@ class tree_type_info : public detail::abstract_uniform_type_info<tree> { ...@@ -130,7 +130,7 @@ class tree_type_info : public detail::abstract_uniform_type_info<tree> {
}; };
typedef std::vector<tree> tree_vector; using tree_vector = std::vector<tree>;
// receives `remaining` messages // receives `remaining` messages
void testee(event_based_actor* self, size_t remaining) { void testee(event_based_actor* self, size_t remaining) {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
namespace cppa { namespace cppa {
namespace { namespace {
typedef std::unique_lock<std::mutex> guard_type; using guard_type = std::unique_lock<std::mutex>;
} }
// m_exit_reason is guaranteed to be set to 0, i.e., exit_reason::not_exited, // m_exit_reason is guaranteed to be set to 0, i.e., exit_reason::not_exited,
......
...@@ -33,10 +33,10 @@ namespace detail { ...@@ -33,10 +33,10 @@ namespace detail {
namespace { namespace {
typedef unique_lock<shared_spinlock> exclusive_guard; using exclusive_guard = unique_lock<shared_spinlock>;
typedef shared_lock<shared_spinlock> shared_guard; using shared_guard = shared_lock<shared_spinlock>;
typedef upgrade_lock<shared_spinlock> upgrade_guard; using upgrade_guard = upgrade_lock<shared_spinlock>;
typedef upgrade_to_unique_lock<shared_spinlock> upgrade_to_unique_guard; using upgrade_to_unique_guard = upgrade_to_unique_lock<shared_spinlock>;
} // namespace <anonymous> } // namespace <anonymous>
......
...@@ -26,13 +26,13 @@ namespace cppa { ...@@ -26,13 +26,13 @@ namespace cppa {
namespace { namespace {
class continuation_decorator : public detail::behavior_impl { class continuation_decorator : public detail::behavior_impl {
typedef behavior_impl super; using super = behavior_impl;
public: public:
typedef behavior::continuation_fun continuation_fun; using continuation_fun = behavior::continuation_fun;
typedef typename behavior_impl::pointer pointer; using pointer = typename behavior_impl::pointer;
continuation_decorator(continuation_fun fun, pointer ptr) continuation_decorator(continuation_fun fun, pointer ptr)
: super(ptr->timeout()), m_fun(fun), m_decorated(std::move(ptr)) { : super(ptr->timeout()), m_fun(fun), m_decorated(std::move(ptr)) {
......
...@@ -37,7 +37,7 @@ namespace cppa { ...@@ -37,7 +37,7 @@ namespace cppa {
namespace { namespace {
typedef const void* pointer; using pointer = const void*;
const char* as_char_pointer(pointer ptr) { const char* as_char_pointer(pointer ptr) {
return reinterpret_cast<const char*>(ptr); return reinterpret_cast<const char*>(ptr);
......
...@@ -222,7 +222,7 @@ void mv(std::string& lhs, const std::basic_string<WCHAR>& rhs) { ...@@ -222,7 +222,7 @@ void mv(std::string& lhs, const std::basic_string<WCHAR>& rhs) {
} }
std::string get_root_uuid() { std::string get_root_uuid() {
typedef std::basic_string<TCHAR> tchar_str; using tchar_str = std::basic_string<TCHAR>;
string uuid; string uuid;
TCHAR buf[max_drive_name]; // temporary buffer for volume name TCHAR buf[max_drive_name]; // temporary buffer for volume name
tchar_str drive = TEXT("c:\\"); // string "template" for drive specifier tchar_str drive = TEXT("c:\\"); // string "template" for drive specifier
......
...@@ -42,10 +42,10 @@ namespace detail { ...@@ -42,10 +42,10 @@ namespace detail {
namespace { namespace {
typedef unique_lock<detail::shared_spinlock> exclusive_guard; using exclusive_guard = unique_lock<detail::shared_spinlock>;
typedef shared_lock<detail::shared_spinlock> shared_guard; using shared_guard = shared_lock<detail::shared_spinlock>;
typedef upgrade_lock<detail::shared_spinlock> upgrade_guard; using upgrade_guard = upgrade_lock<detail::shared_spinlock>;
typedef upgrade_to_unique_lock<detail::shared_spinlock> upgrade_to_unique_guard; using upgrade_to_unique_guard = upgrade_to_unique_lock<detail::shared_spinlock>;
class local_broker; class local_broker;
class local_group_module; class local_group_module;
...@@ -116,7 +116,7 @@ class local_group : public abstract_group { ...@@ -116,7 +116,7 @@ class local_group : public abstract_group {
}; };
typedef intrusive_ptr<local_group> local_group_ptr; using local_group_ptr = intrusive_ptr<local_group>;
class local_broker : public event_based_actor { class local_broker : public event_based_actor {
...@@ -194,7 +194,7 @@ class proxy_broker; ...@@ -194,7 +194,7 @@ class proxy_broker;
class local_group_proxy : public local_group { class local_group_proxy : public local_group {
typedef local_group super; using super = local_group;
public: public:
...@@ -244,7 +244,7 @@ class local_group_proxy : public local_group { ...@@ -244,7 +244,7 @@ class local_group_proxy : public local_group {
}; };
typedef intrusive_ptr<local_group_proxy> local_group_proxy_ptr; using local_group_proxy_ptr = intrusive_ptr<local_group_proxy>;
class proxy_broker : public event_based_actor { class proxy_broker : public event_based_actor {
...@@ -267,7 +267,7 @@ class proxy_broker : public event_based_actor { ...@@ -267,7 +267,7 @@ class proxy_broker : public event_based_actor {
class local_group_module : public abstract_group::module { class local_group_module : public abstract_group::module {
typedef abstract_group::module super; using super = abstract_group::module;
public: public:
......
...@@ -42,7 +42,7 @@ pthread_once_t s_key_once = PTHREAD_ONCE_INIT; ...@@ -42,7 +42,7 @@ pthread_once_t s_key_once = PTHREAD_ONCE_INIT;
memory_cache::~memory_cache() {} memory_cache::~memory_cache() {}
typedef map<const type_info*, unique_ptr<memory_cache>> cache_map; using cache_map = map<const type_info*, unique_ptr<memory_cache>>;
void cache_map_destructor(void* ptr) { void cache_map_destructor(void* ptr) {
if (ptr) delete reinterpret_cast<cache_map*>(ptr); if (ptr) delete reinterpret_cast<cache_map*>(ptr);
......
...@@ -61,8 +61,8 @@ namespace { ...@@ -61,8 +61,8 @@ namespace {
// typedef 8 and 32 bit types, resp. // typedef 8 and 32 bit types, resp.
// adapt these, if necessary, for your operating system and compiler // adapt these, if necessary, for your operating system and compiler
typedef unsigned char byte; using byte = unsigned char;
typedef uint32_t dword; using dword = uint32_t;
// macro definitions // macro definitions
......
...@@ -67,7 +67,7 @@ class dummy_backend : public actor_namespace::backend { ...@@ -67,7 +67,7 @@ class dummy_backend : public actor_namespace::backend {
// - atoms are serialized '...' // - atoms are serialized '...'
class string_serializer : public serializer, public dummy_backend { class string_serializer : public serializer, public dummy_backend {
typedef serializer super; using super = serializer;
ostream& out; ostream& out;
actor_namespace m_namespace; actor_namespace m_namespace;
...@@ -217,9 +217,9 @@ class string_serializer : public serializer, public dummy_backend { ...@@ -217,9 +217,9 @@ class string_serializer : public serializer, public dummy_backend {
class string_deserializer : public deserializer, public dummy_backend { class string_deserializer : public deserializer, public dummy_backend {
typedef deserializer super; using super = deserializer;
typedef string::iterator::difference_type difference_type; using difference_type = string::iterator::difference_type;
string m_str; string m_str;
string::iterator m_pos; string::iterator m_pos;
......
...@@ -172,7 +172,7 @@ class parse_tree { ...@@ -172,7 +172,7 @@ class parse_tree {
static parse_tree parse(Iterator first, Iterator last) { static parse_tree parse(Iterator first, Iterator last) {
PARSER_INIT((std::string{first, last})); PARSER_INIT((std::string{first, last}));
parse_tree result; parse_tree result;
typedef std::pair<Iterator, Iterator> range; using range = std::pair<Iterator, Iterator>;
std::vector<range> subranges; std::vector<range> subranges;
/* lifetime scope of temporary variables needed to fill 'subranges' */ { /* lifetime scope of temporary variables needed to fill 'subranges' */ {
auto find_end = [&](Iterator from)->Iterator { auto find_end = [&](Iterator from)->Iterator {
......
...@@ -563,7 +563,7 @@ class uti_base : public uniform_type_info { ...@@ -563,7 +563,7 @@ class uti_base : public uniform_type_info {
template<typename T> template<typename T>
class uti_impl : public uti_base<T> { class uti_impl : public uti_base<T> {
typedef uti_base<T> super; using super = uti_base<T>;
public: public:
......
...@@ -45,7 +45,7 @@ inline bool operator==(const iint& lhs, int rhs) { return lhs.value == rhs; } ...@@ -45,7 +45,7 @@ inline bool operator==(const iint& lhs, int rhs) { return lhs.value == rhs; }
inline bool operator==(int lhs, const iint& rhs) { return lhs == rhs.value; } inline bool operator==(int lhs, const iint& rhs) { return lhs == rhs.value; }
typedef cppa::detail::single_reader_queue<iint> iint_queue; using iint_queue = cppa::detail::single_reader_queue<iint>;
int main() { int main() {
CPPA_TEST(test_intrusive_containers); CPPA_TEST(test_intrusive_containers);
......
...@@ -31,8 +31,8 @@ struct class1 : class0 { ...@@ -31,8 +31,8 @@ struct class1 : class0 {
}; };
typedef intrusive_ptr<class0> class0_ptr; using class0_ptr = intrusive_ptr<class0>;
typedef intrusive_ptr<class1> class1_ptr; using class1_ptr = intrusive_ptr<class1>;
class0* get_test_rc() { return new class0; } class0* get_test_rc() { return new class0; }
......
...@@ -29,8 +29,8 @@ int main() { ...@@ -29,8 +29,8 @@ int main() {
CPPA_TEST(test_metaprogramming); CPPA_TEST(test_metaprogramming);
typedef type_list<int, float, std::string> l1; using l1 = type_list<int, float, std::string>;
typedef typename tl_reverse<l1>::type r1; using r1 = typename tl_reverse<l1>::type;
CPPA_CHECK((is_same<int, tl_at<l1, 0>::type>::value)); CPPA_CHECK((is_same<int, tl_at<l1, 0>::type>::value));
CPPA_CHECK((is_same<float, tl_at<l1, 1>::type>::value)); CPPA_CHECK((is_same<float, tl_at<l1, 1>::type>::value));
...@@ -42,7 +42,7 @@ int main() { ...@@ -42,7 +42,7 @@ int main() {
CPPA_CHECK((is_same<tl_at<l1, 1>::type, tl_at<r1, 1>::type>::value)); CPPA_CHECK((is_same<tl_at<l1, 1>::type, tl_at<r1, 1>::type>::value));
CPPA_CHECK((is_same<tl_at<l1, 2>::type, tl_at<r1, 0>::type>::value)); CPPA_CHECK((is_same<tl_at<l1, 2>::type, tl_at<r1, 0>::type>::value));
typedef tl_concat<type_list<int>, l1>::type l2; using l2 = tl_concat<type_list<int>, l1>::type;
CPPA_CHECK((is_same<int, tl_head<l2>::type>::value)); CPPA_CHECK((is_same<int, tl_head<l2>::type>::value));
CPPA_CHECK((is_same<l1, tl_tail<l2>::type>::value)); CPPA_CHECK((is_same<l1, tl_tail<l2>::type>::value));
...@@ -50,17 +50,17 @@ int main() { ...@@ -50,17 +50,17 @@ int main() {
CPPA_CHECK_EQUAL((detail::tl_count<l1, is_int>::value), 1); CPPA_CHECK_EQUAL((detail::tl_count<l1, is_int>::value), 1);
CPPA_CHECK_EQUAL((detail::tl_count<l2, is_int>::value), 2); CPPA_CHECK_EQUAL((detail::tl_count<l2, is_int>::value), 2);
typedef int_list<0, 1, 2, 3, 4, 5> il0; using il0 = int_list<0, 1, 2, 3, 4, 5>;
typedef int_list<4, 5> il1; using il1 = int_list<4, 5>;
typedef typename il_right<il0, 2>::type il2; using il2 = typename il_right<il0, 2>::type;
CPPA_CHECK_VERBOSE((is_same<il2, il1>::value), CPPA_CHECK_VERBOSE((is_same<il2, il1>::value),
"il_right<il0, 2> returned " "il_right<il0, 2> returned "
<< detail::demangle<il2>() << detail::demangle<il2>()
<< "expected: " << detail::demangle<il1>()); << "expected: " << detail::demangle<il1>());
/* test tl_is_strict_subset */ { /* test tl_is_strict_subset */ {
typedef type_list<int, float, double> list_a; using list_a = type_list<int, float, double>;
typedef type_list<float, int, double, std::string> list_b; using list_b = type_list<float, int, double, std::string>;
CPPA_CHECK((tl_is_strict_subset<list_a, list_b>::value)); CPPA_CHECK((tl_is_strict_subset<list_a, list_b>::value));
CPPA_CHECK(!(tl_is_strict_subset<list_b, list_a>::value)); CPPA_CHECK(!(tl_is_strict_subset<list_b, list_a>::value));
CPPA_CHECK((tl_is_strict_subset<list_a, list_a>::value)); CPPA_CHECK((tl_is_strict_subset<list_a, list_a>::value));
......
...@@ -20,9 +20,9 @@ using namespace boost::actor_io; ...@@ -20,9 +20,9 @@ using namespace boost::actor_io;
namespace { namespace {
typedef std::pair<std::string, std::string> string_pair; using string_pair = std::pair<std::string, std::string>;
typedef vector<actor> actor_vector; using actor_vector = vector<actor>;
void reflector(event_based_actor* self) { void reflector(event_based_actor* self) {
self->become(others() >> [=] { self->become(others() >> [=] {
......
...@@ -63,7 +63,7 @@ struct struct_b { ...@@ -63,7 +63,7 @@ struct struct_b {
}; };
typedef map<string, u16string> strmap; using strmap = map<string, u16string>;
struct struct_c { struct struct_c {
strmap strings; strmap strings;
...@@ -130,7 +130,7 @@ int main() { ...@@ -130,7 +130,7 @@ int main() {
test_ieee_754(); test_ieee_754();
typedef std::integral_constant<int, detail::impl_id<strmap>()> token; using token = std::integral_constant<int, detail::impl_id<strmap>()>;
CPPA_CHECK_EQUAL(detail::is_iterable<strmap>::value, true); CPPA_CHECK_EQUAL(detail::is_iterable<strmap>::value, true);
CPPA_CHECK_EQUAL(detail::is_stl_compliant_list<vector<int>>::value, true); CPPA_CHECK_EQUAL(detail::is_stl_compliant_list<vector<int>>::value, true);
CPPA_CHECK_EQUAL(detail::is_stl_compliant_list<strmap>::value, false); CPPA_CHECK_EQUAL(detail::is_stl_compliant_list<strmap>::value, false);
......
...@@ -32,7 +32,7 @@ bool operator==(const pong& lhs, const pong& rhs) { ...@@ -32,7 +32,7 @@ bool operator==(const pong& lhs, const pong& rhs) {
using server_type = typed_actor<replies_to<ping>::with<pong>>; using server_type = typed_actor<replies_to<ping>::with<pong>>;
typedef typed_actor<> client_type; using client_type = typed_actor<>;
server_type::behavior_type server() { server_type::behavior_type server() {
return { return {
......
...@@ -37,7 +37,7 @@ struct my_request { ...@@ -37,7 +37,7 @@ struct my_request {
}; };
typedef typed_actor<replies_to<my_request>::with<bool>> server_type; using server_type = typed_actor<replies_to<my_request>::with<bool>>;
bool operator==(const my_request& lhs, const my_request& rhs) { bool operator==(const my_request& lhs, const my_request& rhs) {
return lhs.a == rhs.a && lhs.b == rhs.b; return lhs.a == rhs.a && lhs.b == rhs.b;
...@@ -118,10 +118,12 @@ void test_typed_spawn(server_type ts) { ...@@ -118,10 +118,12 @@ void test_typed_spawn(server_type ts) {
struct get_state_msg {}; struct get_state_msg {};
typedef typed_actor<replies_to<get_state_msg>::with<string>, using event_testee_type = typed_actor<
replies_to<get_state_msg>::with<string>,
replies_to<string>::with<void>, replies_to<string>::with<void>,
replies_to<float>::with<void>, replies_to<float>::with<void>,
replies_to<int>::with<int>> event_testee_type; replies_to<int>::with<int>
>;
class event_testee : public event_testee_type::base { class event_testee : public event_testee_type::base {
...@@ -134,24 +136,29 @@ class event_testee : public event_testee_type::base { ...@@ -134,24 +136,29 @@ class event_testee : public event_testee_type::base {
} }
behavior_type wait4int() { behavior_type wait4int() {
return {on<get_state_msg>() >> [] { return "wait4int"; }, return {
on<get_state_msg>() >> [] { return "wait4int"; },
on<int>() >> [=]()->int {become(wait4float()); on<int>() >> [=]()->int {become(wait4float());
return 42; return 42;
},
(on<float>() || on<string>()) >> skip_message
};
} }
, (on<float>() || on<string>()) >> skip_message
};
}
behavior_type wait4float() { behavior_type wait4float() {
return {on<get_state_msg>() >> [] { return "wait4float"; }, return {
on<get_state_msg>() >> [] {
return "wait4float";
},
on<float>() >> [=] { become(wait4string()); }, on<float>() >> [=] { become(wait4string()); },
(on<string>() || on<int>()) >> skip_message}; (on<string>() || on<int>()) >> skip_message};
} }
behavior_type make_behavior() override { return wait4int(); } behavior_type make_behavior() override {
} return wait4int();
; }
};
void test_event_testee() { void test_event_testee() {
scoped_actor self; scoped_actor self;
...@@ -191,7 +198,7 @@ void test_event_testee() { ...@@ -191,7 +198,7 @@ void test_event_testee() {
* simple 'forwarding' chain * * simple 'forwarding' chain *
******************************************************************************/ ******************************************************************************/
typedef typed_actor<replies_to<string>::with<string>> string_actor; using string_actor = typed_actor<replies_to<string>::with<string>>;
void simple_relay(string_actor::pointer self, string_actor master, bool leaf) { void simple_relay(string_actor::pointer self, string_actor master, bool leaf) {
string_actor next = string_actor next =
...@@ -232,7 +239,7 @@ void test_simple_string_reverter() { ...@@ -232,7 +239,7 @@ void test_simple_string_reverter() {
* sending typed actor handles * * sending typed actor handles *
******************************************************************************/ ******************************************************************************/
typedef typed_actor<replies_to<int>::with<int>> int_actor; using int_actor = typed_actor<replies_to<int>::with<int>>;
int_actor::behavior_type int_fun() { int_actor::behavior_type int_fun() {
return {on_arg_match >> [](int i) { return i * i; }}; return {on_arg_match >> [](int i) { return i * i; }};
......
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