Commit dacdf9ad authored by Dominik Charousset's avatar Dominik Charousset

Simplify implementation of tl_is_strict_subset

parent b6a18114
...@@ -910,32 +910,32 @@ struct tl_apply<type_list<Ts...>, VarArgTemplate> { ...@@ -910,32 +910,32 @@ struct tl_apply<type_list<Ts...>, VarArgTemplate> {
// bool is_strict_subset(list,list) // bool is_strict_subset(list,list)
template <class ListB> template <class List, class T>
struct tl_is_strict_subset_step { constexpr int tlf_find() {
template <class T> return tl_find<List, T>::value;
struct inner { }
using type = std::integral_constant<bool, tl_find<ListB, T>::value != -1>;
}; constexpr bool tlf_no_negative() {
}; return true;
}
template <class T, class... Ts>
constexpr bool tlf_no_negative(T x, Ts... xs) {
return x < 0 ? false : tlf_no_negative(xs...);
}
/// Tests whether ListA ist a strict subset of ListB (or equal). /// Tests whether ListA ist a strict subset of ListB (or equal).
template <class ListA, class ListB> template <class ListA, class ListB>
struct tl_is_strict_subset { struct tl_is_strict_subset;
static constexpr bool value =
std::is_same<ListA, ListB>::value
|| std::is_same< template <class... Ts, class List>
type_list<std::integral_constant<bool, true>>, struct tl_is_strict_subset<type_list<Ts...>, List> {
typename tl_distinct< static constexpr bool value = tlf_no_negative(tlf_find<List, Ts>()...);
typename tl_map<
ListA,
tl_is_strict_subset_step<ListB>::template inner
>::type
>::type
>::value;
}; };
template <class ListA, class ListB> template <class... Ts, class List>
constexpr bool tl_is_strict_subset<ListA, ListB>::value; constexpr bool tl_is_strict_subset<type_list<Ts...>, List>::value;
/// 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.
......
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