Commit e793c81e authored by Dominik Charousset's avatar Dominik Charousset

Fix build on MSVC

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