31 static_assert(has_type<int>(
pack<int, float>{}) ==
true,
"int should be in the pack");
32 static_assert(has_type<double>(
pack<int, float>{}) ==
false,
"double should not be in the pack");
33 static_assert(has_type_v<int, pack<int, float>> ==
true,
"int should be in the pack");
34 static_assert(has_type_v<double, pack<int, float>> ==
false,
"double should not be in the pack");
35 static_assert(std::is_same_v<
decltype(
prune_voids_pack({},
pack<int, int, int, int, int, int, int, int, void>{})),
pack<int, int, int, int, int, int, int, int>>,
"prune last void");
36 static_assert(has_type_conditional_v<std::is_same, int, pack<int, float>> ==
true,
"int should be in the pack");
37 static_assert(has_type_conditional_v<std::is_same, double, pack<int, float>> ==
false,
"double should not be in the pack");
40 static_assert(has_type_at_v<int>(pck) == 2,
"int should be at 2");
41 static_assert(has_type_at_v<double>(pck) ==
pack_size(pck) + 1,
"double is not in the pack so the function returns size + 1");
42 static_assert(has_type_at_conditional_v<std::is_same, bool>(
pack<int, float, bool>()) == 2,
"bool should be at 2");
43 static_assert(has_type_at_conditional_v<std::is_same, bool>(
pack<int, float, double>()) == 3 + 1,
"bool is not in the pack so the function returns size + 1");
45 static_assert(std::is_same_v<selected_pack<is_int_t, int, float, char>,
pack<int>>,
"selector should select int");
46 static_assert(std::is_same_v<selected_pack<is_int_t, int, int, float, char>,
pack<int, int>>,
"selector should select int");
47 static_assert(std::is_same_v<selected_pack<is_int_t, float, int, int, float, char>,
pack<int, int>>,
"selector should select int");
48 static_assert(std::is_same_v<selected_pack_multicondition<is_same_as_second_t, pack<int>,
pack<int, float, char>>,
pack<int>>,
"multiselector should select int");
49 static_assert(std::is_same_v<filtered_pack<is_int_t, int, float, char>,
pack<float, char>>,
"filter should remove int");
51 static_assert(has_type<pack_element_t<0, pack<int>>>(
pack<int>{}) ==
true,
"foo");
52 print_pack<intersected_pack_t<pack<int>,
pack<int>>>();
55 static_assert(std::is_same_v<concatenated_pack_t<pack<int, float, char>,
pack<float, double>>,
pack<int, float, char, float, double>>,
"pack should be concatenated");
56 static_assert(std::is_same_v<concatenated_pack_t<pack<int, float, char>,
pack<float, double>,
pack<char, short>>,
pack<int, float, char, float, double, char, short>>,
"pack should be concatenated");
62 static_assert(std::is_same_v<p3, pack<float, bool, int, double, char>>,
"pack should not have duplicated types");
64 static_assert(std::is_same_v<unique_pack_t<pack<int, float, int, float, char, char>>,
pack<char, float, int>>,
"pack should not have duplicated types");
65 static_assert(std::is_same_v<interleaved_pack_t<pack<int, float, int>,
pack<char, bool, char>>,
pack<int, char, float, bool, int, char>>,
"interleaved packs of the same size");
66 static_assert(std::is_same_v<pack_to_tuple_t<pack<int, float, char>>, std::tuple<int, float, char>>,
"pack should become a tuple");
69 struct ForwardDeclared;
70 static_assert(is_type_complete_v<ForwardDeclared> ==
false,
"This should not be complete because the struct is simply forward declared.");
74 static_assert(is_type_complete_v<Declared> ==
true,
"This should be complete because the struct is fully declared.");
84 call_if_defined<struct Undeclared>([&flag](
auto*) { flag =
true; });
85 REQUIRE(flag ==
false);
88 call_if_defined<struct Declared>([&flag](
auto*) { flag =
true; });
89 REQUIRE(flag ==
true);