Commit e793c81e authored by Dominik Charousset's avatar Dominik Charousset

Fix build on MSVC

parent 9f36b670
...@@ -34,7 +34,11 @@ namespace detail { ...@@ -34,7 +34,11 @@ namespace detail {
/// A list of types. /// A list of types.
template <class... Ts> template <class... Ts>
struct type_list { }; struct type_list {
constexpr type_list() {
// nop
}
};
/// Denotes the empty list. /// Denotes the empty list.
using empty_type_list = type_list<>; using empty_type_list = type_list<>;
...@@ -925,8 +929,8 @@ constexpr bool tlf_no_negative() { ...@@ -925,8 +929,8 @@ constexpr bool tlf_no_negative() {
return true; return true;
} }
template <class T, class... Ts> template <class... Ts>
constexpr bool tlf_no_negative(T x, Ts... xs) { constexpr bool tlf_no_negative(int x, Ts... xs) {
return x < 0 ? false : tlf_no_negative(xs...); return x < 0 ? false : tlf_no_negative(xs...);
} }
...@@ -935,17 +939,12 @@ constexpr bool tlf_is_subset(type_list<Ts...>, List) { ...@@ -935,17 +939,12 @@ constexpr bool tlf_is_subset(type_list<Ts...>, List) {
return tlf_no_negative(tlf_find<Ts>(List{})...); return tlf_no_negative(tlf_find<Ts>(List{})...);
} }
template <class ListA, class ListB>
constexpr bool tlf_is_subset() {
return tlf_is_subset(ListA{}, ListB{});
}
/// Tests whether ListA contains the same elements as ListB /// Tests whether ListA contains the same elements as ListB
/// and vice versa. This comparison ignores element positions. /// and vice versa. This comparison ignores element positions.
template <class ListA, class ListB> template <class ListA, class ListB>
struct tl_equal { struct tl_equal {
static constexpr bool value = tlf_is_subset<ListA, ListB>() static constexpr bool value = tlf_is_subset(ListA{}, ListB{})
&& tlf_is_subset<ListB, ListA>(); && tlf_is_subset(ListB{}, ListA{});
}; };
template <size_t N, class T> template <size_t N, class T>
......
...@@ -87,39 +87,39 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>, ...@@ -87,39 +87,39 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
/// Identifies the base class of brokers implementing this interface. /// Identifies the base class of brokers implementing this interface.
using broker_base = io::experimental::typed_broker<Sigs...>; using broker_base = io::experimental::typed_broker<Sigs...>;
/// Stores the template parameter pack.
using signatures = detail::type_list<Sigs...>;
typed_actor() = default; typed_actor() = default;
typed_actor(typed_actor&&) = default; typed_actor(typed_actor&&) = default;
typed_actor(const typed_actor&) = default; typed_actor(const typed_actor&) = default;
typed_actor& operator=(typed_actor&&) = default; typed_actor& operator=(typed_actor&&) = default;
typed_actor& operator=(const typed_actor&) = default; typed_actor& operator=(const typed_actor&) = default;
template <class... OtherSigs, template <class TypedActor,
class Enable = class Enable = typename std::enable_if<
typename std::enable_if< detail::tlf_is_subset(signatures{},
detail::tlf_is_subset<detail::type_list<Sigs...>, typename TypedActor::signatures{})
detail::type_list<OtherSigs...>>() >::type>
>::type> typed_actor(const TypedActor& other) : ptr_(other.ptr_) {
typed_actor(const typed_actor<OtherSigs...>& other) : ptr_(other.ptr_) {
// nop // nop
} }
template <class... OtherSigs, template <class TypedActor,
class Enable = class Enable = typename std::enable_if<
typename std::enable_if< detail::tlf_is_subset(signatures{},
detail::tlf_is_subset<detail::type_list<Sigs...>, typename TypedActor::signatures{})
detail::type_list<OtherSigs...>>() >::type>
>::type> typed_actor& operator=(const TypedActor& other) {
typed_actor& operator=(const typed_actor<OtherSigs...>& other) {
ptr_ = other.ptr_; ptr_ = other.ptr_;
return *this; return *this;
} }
template <class Impl, template <class Impl,
class Enable = class Enable = typename std::enable_if<
typename std::enable_if< detail::tlf_is_subset(signatures{},
detail::tlf_is_subset<detail::type_list<Sigs...>, typename Impl::signatures{})
typename Impl::signatures>() >::type>
>::type>
typed_actor(intrusive_ptr<Impl> other) : ptr_(std::move(other)) { typed_actor(intrusive_ptr<Impl> other) : ptr_(std::move(other)) {
// nop // nop
} }
......
...@@ -90,9 +90,9 @@ CAF_TEST(metaprogramming) { ...@@ -90,9 +90,9 @@ CAF_TEST(metaprogramming) {
/* test tlf_is_subset */ { /* test tlf_is_subset */ {
using list_a = type_list<int, float, double>; using list_a = type_list<int, float, double>;
using list_b = type_list<float, int, double, std::string>; using list_b = type_list<float, int, double, std::string>;
CAF_CHECK((tlf_is_subset<list_a, list_b>())); CAF_CHECK((tlf_is_subset(list_a{}, list_b{})));
CAF_CHECK(! (tlf_is_subset<list_b, list_a>())); CAF_CHECK(! (tlf_is_subset(list_b{}, list_a{})));
CAF_CHECK((tlf_is_subset<list_a, list_a>())); CAF_CHECK((tlf_is_subset(list_a{}, list_a{})));
CAF_CHECK((tlf_is_subset<list_b, list_b>())); CAF_CHECK((tlf_is_subset(list_b{}, list_b{})));
} }
} }
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