fork download
  1. #include <type_traits>
  2. #include <utility>
  3. #include <tuple>
  4.  
  5. template <template <auto...> class> struct functor_wrapper;
  6.  
  7. namespace detail {
  8. template <typename T>
  9. struct identity { using type = T; };
  10.  
  11. template <typename Pack>
  12. struct simple_pack : identity<Pack> {};
  13.  
  14. template <typename T, template <typename U, U...> class Z, T... Is>
  15. struct simple_pack<Z<T, Is...>> {
  16. template <T...> struct Q;
  17. using type = Q<Is...>;
  18. };
  19.  
  20. template <typename... Packs>
  21. struct sequence_traits;
  22.  
  23. template <typename T, template <T...> class Z, T... Is>
  24. struct sequence_traits<Z<Is...>> {
  25. using value_type = T;
  26. using template_empty = Z<>;
  27. };
  28.  
  29. template <typename T, template <typename U, U...> class Z, T... Is>
  30. struct sequence_traits<Z<T, Is...>> {
  31. using value_type = T;
  32. using template_empty = Z<T>;
  33. };
  34.  
  35. template <typename First, typename... Rest>
  36. struct sequence_traits<First, Rest...> : sequence_traits<First> {};
  37.  
  38. template <template <auto...> class F, typename Second, typename... Rest>
  39. struct sequence_traits<functor_wrapper<F>, Second, Rest...> : sequence_traits<Second> {};
  40.  
  41. template <typename Pack> struct is_empty : std::false_type {};
  42.  
  43. template <template <typename...> class P, typename... Ts>
  44. struct is_empty<P<Ts...>> : std::bool_constant<(sizeof...(Ts) == 0)> {}; // Empty pack of types.
  45.  
  46. template <template <auto...> class Z, auto... Is> // 'auto' (C++17) needed else the type T would need to be made explicit as an extra template parameter.
  47. struct is_empty<Z<Is...>> : std::bool_constant<(sizeof...(Is) == 0)> {}; // Empty sequence.
  48.  
  49. template <typename T, template <typename U, U...> class Z, T... Is>
  50. struct is_empty<Z<T, Is...>> : std::bool_constant<(sizeof...(Is) == 0)> {}; // e.g. std::integer_sequence<int> shall be considered empty.
  51.  
  52. template <typename Pack> struct first_element;
  53.  
  54. template <typename T, template <T...> class Z, T First, T... Rest>
  55. struct first_element<Z<First, Rest...>> : std::integral_constant<T, First> {};
  56.  
  57. template <typename T, template <typename U, U...> class Z, T First, T... Rest>
  58. struct first_element<Z<T, First, Rest...>> : std::integral_constant<T, First> {};
  59.  
  60. template <typename...> struct last;
  61.  
  62. template <typename First, typename... Rest>
  63. struct last<First, Rest...> : last<Rest...> {};
  64.  
  65. template <typename Last>
  66. struct last<Last> : identity<Last> {};
  67.  
  68. // The rest needed for Transform and TransformToEnd
  69. template <typename... Packs> struct empty_pack;
  70.  
  71. template <template <auto...> class Z, auto... Is, typename... Packs>
  72. struct empty_pack<Z<Is...>, Packs...> {
  73. using type = Z<>;
  74. };
  75.  
  76. template <std::size_t N, typename Pack, typename = void> struct get_element;
  77.  
  78. template <std::size_t N, typename T, template <T...> class Z, T... Is>
  79. struct get_element<N, Z<Is...>, std::enable_if_t<(N < sizeof...(Is))>> {
  80. static constexpr T a[sizeof...(Is)] = {Is...};
  81. static constexpr T value = a[N];
  82. };
  83.  
  84. // If N is greater than or equal to sizeof...(Is), then it shall output value T{} (which is zero if T is an integral type).
  85. template <std::size_t N, typename T, template <T...> class Z, T... Is>
  86. struct get_element<N, Z<Is...>, std::enable_if_t<(N >= sizeof...(Is))>> : std::integral_constant<T, T{}> {};
  87.  
  88. template <typename Pack, auto V> struct append;
  89.  
  90. template <template <auto...> class Z, auto... Is, auto V>
  91. struct append<Z<Is...>, V> {
  92. using type = Z<Is..., V>;
  93. };
  94.  
  95. template <typename Sequence> struct sequence_size;
  96.  
  97. template <template <auto...> class Z, auto... Is>
  98. struct sequence_size<Z<Is...>> : std::integral_constant<std::size_t, sizeof...(Is)> {};
  99.  
  100. template <template <auto, auto> class Comparator, auto...> struct extreme_value;
  101.  
  102. template <template <auto, auto> class Comparator, auto A, auto B>
  103. struct extreme_value<Comparator, A,B> : std::integral_constant<decltype(A), Comparator<A,B>::value ? A : B> {};
  104.  
  105. template <template <auto, auto> class Comparator, auto First, auto Second, auto... Rest>
  106. struct extreme_value<Comparator, First, Second, Rest...> : extreme_value<Comparator, First, extreme_value<Comparator, Second, Rest...>::value> {};
  107. }
  108.  
  109. template <typename EmptyContainer, auto... Is> struct output; // 'auto' (C++17) used else the type T would need to be made explicit as an extra template parameter.
  110.  
  111. template <template <auto...> class Z, auto... Is>
  112. struct output<Z<>, Is...> {
  113. using type = Z<Is...>;
  114. };
  115.  
  116. template <typename T, template <typename U, U...> class Z, T... Is>
  117. struct output<Z<T>, Is...> {
  118. using type = Z<T, Is...>;
  119. };
  120.  
  121. template <typename EmptyContainer, typename Output> struct output_h;
  122.  
  123. template <typename EmptyContainer, template <auto...> class Z, auto... Is>
  124. struct output_h<EmptyContainer, Z<Is...>> : output<EmptyContainer, Is...> {};
  125.  
  126. enum CombineType {Merge, FirstFromEach, Interlace, Transform, TransformToEnd};
  127.  
  128. template <CombineType, typename EmptyPack, typename... Packs> struct combine_packs_h;
  129.  
  130. // Merge
  131. template <typename EmptyPack, typename T, template <T...> class Z, T... Is>
  132. struct combine_packs_h<Merge, EmptyPack, Z<Is...>> : output<EmptyPack, Is...> {};
  133.  
  134. template <typename EmptyPack, typename T, template <T...> class Z, T... Is, template <T...> class Q, T... Js>
  135. struct combine_packs_h<Merge, EmptyPack, Z<Is...>, Q<Js...>> : output<EmptyPack, Is..., Js...> {}; // Note that using 'Z<Is...>, Z<Js...>' is not good enough since simple_pack<Pack1>::type does not have the same template as simple_pack<Pack2>::type.
  136.  
  137. template <typename EmptyPack, typename First, typename... Rest>
  138. struct combine_packs_h<Merge, EmptyPack, First, Rest...> : combine_packs_h<Merge, EmptyPack, First, typename combine_packs_h<Merge, typename detail::sequence_traits<Rest...>::template_empty, Rest...>::type> {};
  139. // Note that using EmptyPack instead of typename detail::sequence_traits<Rest...>::template_empty is incorrect because EmptyPack might not be the proper empty pack type for the first pack in Rest...
  140.  
  141. // FirstFromEach
  142. template <typename EmptyPack, typename... Packs>
  143. struct combine_packs_h<FirstFromEach, EmptyPack, Packs...> : output<EmptyPack, detail::first_element<Packs>::value...> {};
  144.  
  145. // Interlace
  146. template <typename Output, typename... Packs> struct interlace;
  147.  
  148. template <typename T, template <T...> class Q, T... Is>
  149. struct interlace<Q<Is...>> : detail::identity<Q<Is...>> {};
  150.  
  151. template <typename T, template <T...> class Q, T... Output, template <T...> class Z, T First, T... Rest, typename... Packs>
  152. struct interlace<Q<Output...>, Z<First, Rest...>, Packs...> : interlace<Q<Output..., First>, Packs..., Z<Rest...>> {};
  153.  
  154. template <typename T, template <T...> class Q, T... Output, template <T...> class Z, typename... Packs>
  155. struct interlace<Q<Output...>, Z<>, Packs...> : interlace<Q<Output...>, Packs...> {};
  156.  
  157. template <typename EmptyPack, typename... Packs>
  158. struct combine_packs_h<Interlace, EmptyPack, Packs...> : output_h<EmptyPack, typename interlace<typename detail::simple_pack<EmptyPack>::type, Packs...>::type> {};
  159.  
  160. // Transform and TransformToEnd (adapted from transform_generalized.cpp)
  161. template <auto A, auto B>
  162. struct less_than : std::bool_constant<(A < B)> {};
  163.  
  164. template <auto A, auto B>
  165. struct greater_than : std::bool_constant<(A > B)> {};
  166.  
  167. template <template <auto...> class F, std::size_t N, std::size_t End, typename Output, typename... Packs>
  168. struct transform_h : transform_h<F, N+1, End, typename detail::append<Output, F<detail::get_element<N, Packs>::value...>::value>::type, Packs...> {};
  169.  
  170. template <template <auto...> class F, std::size_t End, typename Output, typename... Packs>
  171. struct transform_h<F, End, End, Output, Packs...> : detail::identity<Output> {};
  172.  
  173. template <typename EmptyPack, template <auto, auto> class Comparator, template <auto...> class F, typename... Packs>
  174. using do_transform = output_h<EmptyPack, typename transform_h<F, 0, detail::extreme_value<Comparator, detail::sequence_size<Packs>::value...>::value, typename detail::empty_pack<Packs...>::type, Packs...>::type>;
  175.  
  176. template <typename EmptyPack, template <auto...> class F, typename... Packs>
  177. struct combine_packs_h<Transform, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, less_than, F, Packs...> {};
  178.  
  179. template <typename EmptyPack, template <auto...> class F, typename... Packs>
  180. struct combine_packs_h<TransformToEnd, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, greater_than, F, Packs...> {};
  181.  
  182. // combine_packs
  183. template <typename Pack> struct remove_last;
  184.  
  185. template <CombineType C, template <CombineType, typename...> class P, typename EmptyPack, typename... Ts>
  186. struct remove_last<P<C, EmptyPack, Ts...>> {
  187. template <std::size_t... Is>
  188. static auto execute (const std::index_sequence<Is...>&) -> P<C, EmptyPack, std::tuple_element_t<Is, std::tuple<Ts...>>...>;
  189.  
  190. using type = decltype(execute(std::make_index_sequence<sizeof...(Ts) - 1>{}));
  191. };
  192.  
  193. template <CombineType C, typename... Packs> // The first pack P in Packs... could be functor_wrapper<F> if CombineType is Transform or TransformToEnd, in which simple_pack<P>::type is simply P due to the use of detail::identity.
  194. struct combine_packs {
  195. using Last = typename detail::last<Packs...>::type; // Use split_last, so that Last is obtained, as well as all the packs except Last.
  196. static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
  197. using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>; // Change this if first pack is a Functor
  198. using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
  199. using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
  200. using type = typename meta::type;
  201. // using type = typename combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>::type; // This original line of mine is incorrect. We must remove the last pack from Packs... if detail::is_empty<Last>::value == true (since that last pack is empty).
  202. };
  203.  
  204. // The following (original) syntax for combine_packs is awkward, because the EmptyPack must always be given even if we want the default no change in container template.
  205. //template <CombineType C, typename EmptyPack, typename... Packs> // The first pack P in Packs... could be a meta-function struct if CombineType is Transform, in which simple_pack<P>::type is simply P.
  206. //struct combine_packs : combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...> {};
  207.  
  208. // Testing
  209. #include <iostream>
  210.  
  211. template <int...> struct Z {};
  212. template <int...> struct Q;
  213. template <int...> struct R;
  214. template <std::size_t...> struct I;
  215.  
  216. template <int A, int B, int C>
  217. struct foo : std::integral_constant<int, A + 2*B + 3*C> {};
  218.  
  219. int main() {
  220. std::cout << std::boolalpha << std::is_same<
  221. combine_packs<Merge, Z<0,1,2,3>, Q<4,5,6>, R<>>::type,
  222. R<0,1,2,3,4,5,6>
  223. >::value << '\n'; // true
  224.  
  225. std::cout << std::is_same<
  226. combine_packs<Merge, Z<0,1,2,3>, Z<4,5,6>>::type,
  227. Z<0,1,2,3,4,5,6>
  228. >::value << '\n'; // true
  229.  
  230. std::cout << std::is_same<
  231. combine_packs<Merge, Z<0,1,2,3>, Q<4,5,6>, R<7,8>>::type,
  232. Z<0,1,2,3,4,5,6,7,8>
  233. >::value << '\n'; // true
  234.  
  235. std::cout << std::is_same<
  236. combine_packs<Merge, std::index_sequence<0,1,2,3>>::type,
  237. std::index_sequence<0,1,2,3>
  238. >::value << '\n'; // true
  239.  
  240. std::cout << std::is_same<
  241. combine_packs<Merge, std::index_sequence<0,1,2,3>, std::index_sequence<4,5,6>>::type,
  242. std::index_sequence<0,1,2,3,4,5,6>
  243. >::value << '\n'; // true
  244.  
  245. std::cout << std::is_same<
  246. combine_packs<Merge, std::index_sequence<0,1,2,3>, std::index_sequence<4,5,6>, std::index_sequence<7,8>, I<>>::type,
  247. I<0,1,2,3,4,5,6,7,8>
  248. >::value << '\n'; // true
  249.  
  250. std::cout << std::is_same<
  251. combine_packs<Merge, std::index_sequence<0,1,2,3>, I<4,5,6>, std::index_sequence<7,8>, std::integer_sequence<std::size_t>>::type,
  252. std::integer_sequence<std::size_t, 0,1,2,3,4,5,6,7,8>
  253. >::value << '\n'; // true
  254.  
  255. std::cout << std::is_same<
  256. combine_packs<Merge, std::index_sequence<0,1,2,3>, I<4,5,6>, I<7,8>, std::index_sequence<9>>::type,
  257. std::index_sequence<0,1,2,3,4,5,6,7,8,9>
  258. >::value << '\n'; // true
  259.  
  260. std::cout << std::is_same<
  261. combine_packs<Merge, std::make_index_sequence<4>, std::index_sequence<4,5,6>, std::index_sequence<7,8>, std::index_sequence<9>, I<>>::type,
  262. I<0,1,2,3,4,5,6,7,8,9>
  263. >::value << '\n'; // true
  264.  
  265. std::cout << std::is_same<
  266. combine_packs<Merge, I<0,1,2,3>, I<4,5,6>, I<7,8>, I<9>, std::integer_sequence<std::size_t>>::type,
  267. std::index_sequence<0,1,2,3,4,5,6,7,8,9>
  268. >::value << '\n'; // true
  269.  
  270. std::cout << std::is_same<
  271. combine_packs<FirstFromEach, Z<0,1,2,3>, Z<4,5,6>, Z<7,8>, Z<9>>::type,
  272. Z<0,4,7,9>
  273. >::value << '\n'; // true
  274.  
  275. std::cout << std::is_same<
  276. combine_packs<FirstFromEach, Z<0,1,2,3>, Q<4,5,6>, Z<7,8>, R<9>>::type,
  277. Z<0,4,7,9>
  278. >::value << '\n'; // true
  279.  
  280. std::cout << std::is_same<
  281. combine_packs<FirstFromEach, std::make_index_sequence<10>, std::index_sequence<4,5,6>, I<7,8>, std::index_sequence<9>>::type,
  282. std::index_sequence<0,4,7,9>
  283. >::value << '\n'; // true
  284.  
  285. std::cout << std::is_same<
  286. combine_packs<FirstFromEach, Z<0,1,2,3>, Z<4,5,6>, Z<7,8>, Z<9>, Q<>>::type,
  287. Q<0,4,7,9>
  288. >::value << '\n'; // true
  289.  
  290. std::cout << std::is_same<
  291. combine_packs<FirstFromEach, std::make_index_sequence<10>, I<4,5,6>, Z<7,8>, std::index_sequence<9>, I<>>::type,
  292. I<0,4,7,9>
  293. >::value << '\n'; // true
  294.  
  295. std::cout << std::is_same<
  296. combine_packs<FirstFromEach, std::make_index_sequence<10>, R<4,5,6>, Z<7,8>, I<9>, std::integer_sequence<std::size_t>>::type,
  297. std::index_sequence<0,4,7,9>
  298. >::value << '\n'; // true
  299.  
  300. std::cout << std::is_same<
  301. combine_packs<Interlace, Z<0,1,2>, Z<3,4,5>, Z<6,7,8>>::type,
  302. Z<0,3,6,1,4,7,2,5,8>
  303. >::value << '\n'; // true
  304.  
  305. std::cout << std::is_same<
  306. combine_packs<Interlace, Z<0,1,2>, Q<3,4>, R<5,6,7,8,9,10>>::type,
  307. Z<0,3,5,1,4,6,2,7,8,9,10>
  308. >::value << '\n'; // true
  309.  
  310. std::cout << std::is_same<
  311. combine_packs<Interlace, std::index_sequence<0,1,2>, I<3,4>, std::index_sequence<5,6,7,8,9,10>>::type,
  312. std::index_sequence<0,3,5,1,4,6,2,7,8,9,10>
  313. >::value << '\n'; // true
  314.  
  315. std::cout << std::is_same<
  316. combine_packs<Interlace, std::index_sequence<0,1,2>, std::index_sequence<3,4>, std::index_sequence<5,6,7,8,9,10>, I<>>::type,
  317. I<0,3,5,1,4,6,2,7,8,9,10>
  318. >::value << '\n'; // true
  319.  
  320. std::cout << std::is_same<
  321. combine_packs<Transform, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, Z<1,2,-1,3,1>>::type,
  322. Z<15,30,-15,45>
  323. >::value << '\n'; // true
  324.  
  325. std::cout << std::is_same<
  326. combine_packs<TransformToEnd, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, Z<1,2,-1,3,1>>::type,
  327. Z<15,30,-15,45,5,2,2>
  328. >::value << '\n'; // true
  329.  
  330. std::cout << std::is_same<
  331. combine_packs<Transform, functor_wrapper<foo>, Q<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, R<1,2,-1,3,1>>::type,
  332. Q<15,30,-15,45>
  333. >::value << '\n'; // true
  334.  
  335. std::cout << std::is_same<
  336. combine_packs<TransformToEnd, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Q<5,10,-5,15>, R<1,2,-1,3,1>, R<>>::type,
  337. R<15,30,-15,45,5,2,2>
  338. >::value << '\n'; // true
  339.  
  340. std::cout << std::is_same<
  341. combine_packs<Transform, functor_wrapper<foo>, std::index_sequence<2,4,-2,6,2,2,2>, std::index_sequence<5,10,-5,15>, std::index_sequence<1,2,-1,3,1>>::type,
  342. std::index_sequence<15,30,-15,45>
  343. >::value << '\n'; // true
  344.  
  345. std::cout << std::is_same<
  346. combine_packs<TransformToEnd, functor_wrapper<foo>, std::index_sequence<2,4,-2,6,2,2,2>, I<5,10,-5,15>, std::index_sequence<1,2,-1,3,1>, I<>>::type,
  347. I<15,30,-15,45,5,2,2>
  348. >::value << '\n'; // true
  349.  
  350. std::cout << std::is_same<
  351. combine_packs<TransformToEnd, functor_wrapper<foo>, I<2,4,-2,6,2,2,2>, I<5,10,-5,15>, std::index_sequence<1,2,-1,3,1>, std::integer_sequence<std::size_t>>::type,
  352. std::index_sequence<15,30,-15,45,5,2,2>
  353. >::value << '\n'; // true
  354.  
  355. std::cin.get();
  356. }
  357.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:25: error: ‘auto’ parameter not permitted in this context
 template <template <auto...> class> struct functor_wrapper;
                         ^~~
prog.cpp:24:12: error: template parameters not deducible in partial specialization:
     struct sequence_traits<Z<Is...>> {
            ^~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:24:12: note:         ‘T’
prog.cpp:38:26: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class F, typename Second, typename... Rest>
                          ^~~
prog.cpp:39:42: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
  struct sequence_traits<functor_wrapper<F>, Second, Rest...> : sequence_traits<Second> {};
                                          ^
prog.cpp:39:42: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<<typeprefixerror>...<anonymous> > class F’
prog.cpp:39:60: error: template argument 1 is invalid
  struct sequence_traits<functor_wrapper<F>, Second, Rest...> : sequence_traits<Second> {};
                                                            ^
prog.cpp:44:48: error: expected template-name before ‘<’ token
  struct is_empty<P<Ts...>> : std::bool_constant<(sizeof...(Ts) == 0)> {};  // Empty pack of types.
                                                ^
prog.cpp:44:48: error: expected ‘{’ before ‘<’ token
prog.cpp:46:26: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is>  // 'auto' (C++17) needed else the type T would need to be made explicit as an extra template parameter.
                          ^~~
prog.cpp:46:48: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is>  // 'auto' (C++17) needed else the type T would need to be made explicit as an extra template parameter.
                                                ^~
prog.cpp:47:22: note: invalid template non-type parameter
  struct is_empty<Z<Is...>> : std::bool_constant<(sizeof...(Is) == 0)> {};  // Empty sequence.
                      ^~~
prog.cpp:47:25: error: template argument 1 is invalid
  struct is_empty<Z<Is...>> : std::bool_constant<(sizeof...(Is) == 0)> {};  // Empty sequence.
                         ^~
prog.cpp:47:48: error: expected template-name before ‘<’ token
  struct is_empty<Z<Is...>> : std::bool_constant<(sizeof...(Is) == 0)> {};  // Empty sequence.
                                                ^
prog.cpp:50:51: error: expected template-name before ‘<’ token
  struct is_empty<Z<T, Is...>> : std::bool_constant<(sizeof...(Is) == 0)> {};  // e.g. std::integer_sequence<int> shall be considered empty.
                                                   ^
prog.cpp:50:51: error: expected ‘{’ before ‘<’ token
prog.cpp:55:9: error: template parameters not deducible in partial specialization:
  struct first_element<Z<First, Rest...>> : std::integral_constant<T, First> {};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:55:9: note:         ‘T’
prog.cpp:71:26: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is, typename... Packs>
                          ^~~
prog.cpp:71:48: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is, typename... Packs>
                                                ^~
prog.cpp:72:27: note: invalid template non-type parameter
  struct empty_pack<Z<Is...>, Packs...> {
                           ^
prog.cpp:72:38: error: template argument 1 is invalid
  struct empty_pack<Z<Is...>, Packs...> {
                                      ^
prog.cpp:79:9: error: template parameters not deducible in partial specialization:
  struct get_element<N, Z<Is...>, std::enable_if_t<(N < sizeof...(Is))>> {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:79:9: note:         ‘T’
prog.cpp:86:9: error: template parameters not deducible in partial specialization:
  struct get_element<N, Z<Is...>, std::enable_if_t<(N >= sizeof...(Is))>> : std::integral_constant<T, T{}> {};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:86:9: note:         ‘T’
prog.cpp:88:32: error: ‘auto’ parameter not permitted in this context
  template <typename Pack, auto V> struct append;
                                ^
prog.cpp:90:26: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is, auto V>
                          ^~~
prog.cpp:90:48: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is, auto V>
                                                ^~
prog.cpp:90:57: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is, auto V>
                                                         ^
prog.cpp:91:23: note: invalid template non-type parameter
  struct append<Z<Is...>, V> {
                       ^
prog.cpp:91:27: error: template argument 1 is invalid
  struct append<Z<Is...>, V> {
                           ^
prog.cpp:91:27: note: invalid template non-type parameter
prog.cpp:97:26: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is>
                          ^~~
prog.cpp:97:48: error: ‘auto’ parameter not permitted in this context
  template <template <auto...> class Z, auto... Is>
                                                ^~
prog.cpp:98:27: note: invalid template non-type parameter
  struct sequence_size<Z<Is...>> : std::integral_constant<std::size_t, sizeof...(Is)> {};
                           ^~~
prog.cpp:98:30: error: template argument 1 is invalid
  struct sequence_size<Z<Is...>> : std::integral_constant<std::size_t, sizeof...(Is)> {};
                              ^~
prog.cpp:100:22: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto...> struct extreme_value;
                      ^~~~
prog.cpp:100:28: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto...> struct extreme_value;
                            ^~~~
prog.cpp:100:56: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto...> struct extreme_value;
                                                        ^~~
prog.cpp:102:22: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto A, auto B>
                      ^~~~
prog.cpp:102:28: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto A, auto B>
                            ^~~~
prog.cpp:102:57: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto A, auto B>
                                                         ^
prog.cpp:102:65: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto A, auto B>
                                                                 ^
prog.cpp:103:38: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator, <typeprefixerror>...<anonymous> > struct detail::extreme_value’
  struct extreme_value<Comparator, A,B> : std::integral_constant<decltype(A), Comparator<A,B>::value ? A : B> {};
                                      ^
prog.cpp:103:38: note:   expected a template of type ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’, got ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’
prog.cpp:103:38: note: invalid template non-type parameter
prog.cpp:103:38: note: invalid template non-type parameter
prog.cpp:103:92: note: invalid template non-type parameter
  struct extreme_value<Comparator, A,B> : std::integral_constant<decltype(A), Comparator<A,B>::value ? A : B> {};
                                                                                            ^
prog.cpp:103:92: note: invalid template non-type parameter
prog.cpp:103:108: error: template argument 1 is invalid
  struct extreme_value<Comparator, A,B> : std::integral_constant<decltype(A), Comparator<A,B>::value ? A : B> {};
                                                                                                            ^
prog.cpp:103:108: error: template argument 2 is invalid
prog.cpp:105:22: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto First, auto Second, auto... Rest>
                      ^~~~
prog.cpp:105:28: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto First, auto Second, auto... Rest>
                            ^~~~
prog.cpp:105:57: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto First, auto Second, auto... Rest>
                                                         ^~~~~
prog.cpp:105:69: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto First, auto Second, auto... Rest>
                                                                     ^~~~~~
prog.cpp:105:85: error: ‘auto’ parameter not permitted in this context
  template <template <auto, auto> class Comparator, auto First, auto Second, auto... Rest>
                                                                                     ^~~~
prog.cpp:106:57: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator, <typeprefixerror>...<anonymous> > struct detail::extreme_value’
  struct extreme_value<Comparator, First, Second, Rest...> : extreme_value<Comparator, First, extreme_value<Comparator, Second, Rest...>::value> {};
                                                         ^
prog.cpp:106:57: note:   expected a template of type ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’, got ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’
prog.cpp:106:57: note: invalid template non-type parameter
prog.cpp:106:57: note: invalid template non-type parameter
prog.cpp:106:57: note: invalid template non-type parameter
prog.cpp:106:135: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator, <typeprefixerror>...<anonymous> > struct detail::extreme_value’
  struct extreme_value<Comparator, First, Second, Rest...> : extreme_value<Comparator, First, extreme_value<Comparator, Second, Rest...>::value> {};
                                                                                                                                       ^
prog.cpp:106:135: note:   expected a template of type ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’, got ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’
prog.cpp:106:135: note: invalid template non-type parameter
prog.cpp:106:135: note: invalid template non-type parameter
prog.cpp:106:143: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator, <typeprefixerror>...<anonymous> > struct detail::extreme_value’
  struct extreme_value<Comparator, First, Second, Rest...> : extreme_value<Comparator, First, extreme_value<Comparator, Second, Rest...>::value> {};
                                                                                                                                               ^
prog.cpp:106:143: note:   expected a template of type ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’, got ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’
prog.cpp:106:143: note: invalid template non-type parameter
prog.cpp:106:143: error: template argument 3 is invalid
prog.cpp:109:44: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyContainer, auto... Is> struct output;  // 'auto' (C++17) used else the type T would need to be made explicit as an extra template parameter.
                                            ^~
prog.cpp:111:25: error: ‘auto’ parameter not permitted in this context
 template <template <auto...> class Z, auto... Is>
                         ^~~
prog.cpp:111:47: error: ‘auto’ parameter not permitted in this context
 template <template <auto...> class Z, auto... Is>
                                               ^~
prog.cpp:112:25: note: invalid template non-type parameter
 struct output<Z<>, Is...> {
                         ^
prog.cpp:117:26: note: invalid template non-type parameter
 struct output<Z<T>, Is...> {
                          ^
prog.cpp:123:50: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyContainer, template <auto...> class Z, auto... Is>
                                                  ^~~
prog.cpp:123:72: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyContainer, template <auto...> class Z, auto... Is>
                                                                        ^~
prog.cpp:124:37: note: invalid template non-type parameter
 struct output_h<EmptyContainer, Z<Is...>> : output<EmptyContainer, Is...> {};
                                     ^~~
prog.cpp:124:40: error: template argument 2 is invalid
 struct output_h<EmptyContainer, Z<Is...>> : output<EmptyContainer, Is...> {};
                                        ^~
prog.cpp:124:73: note: invalid template non-type parameter
 struct output_h<EmptyContainer, Z<Is...>> : output<EmptyContainer, Is...> {};
                                                                         ^
prog.cpp:132:8: error: template parameters not deducible in partial specialization:
 struct combine_packs_h<Merge, EmptyPack, Z<Is...>> : output<EmptyPack, Is...> {};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:132:8: note:         ‘T’
prog.cpp:132:77: note: invalid template non-type parameter
 struct combine_packs_h<Merge, EmptyPack, Z<Is...>> : output<EmptyPack, Is...> {};
                                                                             ^
prog.cpp:135:8: error: template parameters not deducible in partial specialization:
 struct combine_packs_h<Merge, EmptyPack, Z<Is...>, Q<Js...>> : output<EmptyPack, Is..., Js...> {};  // Note that using 'Z<Is...>, Z<Js...>' is not good enough since simple_pack<Pack1>::type does not have the same template as simple_pack<Pack2>::type.
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:135:8: note:         ‘T’
prog.cpp:135:94: note: invalid template non-type parameter
 struct combine_packs_h<Merge, EmptyPack, Z<Is...>, Q<Js...>> : output<EmptyPack, Is..., Js...> {};  // Note that using 'Z<Is...>, Z<Js...>' is not good enough since simple_pack<Pack1>::type does not have the same template as simple_pack<Pack2>::type.
                                                                                              ^
prog.cpp:135:94: note: invalid template non-type parameter
prog.cpp:143:118: note: invalid template non-type parameter
 struct combine_packs_h<FirstFromEach, EmptyPack, Packs...> : output<EmptyPack, detail::first_element<Packs>::value...> {};
                                                                                                                      ^
prog.cpp:149:8: error: template parameters not deducible in partial specialization:
 struct interlace<Q<Is...>> : detail::identity<Q<Is...>> {};
        ^~~~~~~~~~~~~~~~~~~
prog.cpp:149:8: note:         ‘T’
prog.cpp:152:8: error: template parameters not deducible in partial specialization:
 struct interlace<Q<Output...>, Z<First, Rest...>, Packs...> : interlace<Q<Output..., First>, Packs..., Z<Rest...>> {};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:152:8: note:         ‘T’
prog.cpp:155:8: error: template parameters not deducible in partial specialization:
 struct interlace<Q<Output...>, Z<>, Packs...> : interlace<Q<Output...>, Packs...> {};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:155:8: note:         ‘T’
prog.cpp:161:16: error: ‘auto’ parameter not permitted in this context
 template <auto A, auto B>
                ^
prog.cpp:161:24: error: ‘auto’ parameter not permitted in this context
 template <auto A, auto B>
                        ^
prog.cpp:162:38: error: expected template-name before ‘<’ token
 struct less_than : std::bool_constant<(A < B)> {};
                                      ^
prog.cpp:162:38: error: expected ‘{’ before ‘<’ token
prog.cpp:164:16: error: ‘auto’ parameter not permitted in this context
 template <auto A, auto B>
                ^
prog.cpp:164:24: error: ‘auto’ parameter not permitted in this context
 template <auto A, auto B>
                        ^
prog.cpp:165:41: error: expected template-name before ‘<’ token
 struct greater_than : std::bool_constant<(A > B)> {};
                                         ^
prog.cpp:165:41: error: expected ‘{’ before ‘<’ token
prog.cpp:167:25: error: ‘auto’ parameter not permitted in this context
 template <template <auto...> class F, std::size_t N, std::size_t End, typename Output, typename... Packs>
                         ^~~
prog.cpp:168:120: note: invalid template non-type parameter
 struct transform_h : transform_h<F, N+1, End, typename detail::append<Output, F<detail::get_element<N, Packs>::value...>::value>::type, Packs...> {};
                                                                                                                        ^
prog.cpp:168:128: error: template argument 2 is invalid
 struct transform_h : transform_h<F, N+1, End, typename detail::append<Output, F<detail::get_element<N, Packs>::value...>::value>::type, Packs...> {};
                                                                                                                                ^
prog.cpp:168:145: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class F, long unsigned int N, long unsigned int End, class Output, class ... Packs> struct transform_h’
 struct transform_h : transform_h<F, N+1, End, typename detail::append<Output, F<detail::get_element<N, Packs>::value...>::value>::type, Packs...> {};
                                                                                                                                                 ^
prog.cpp:168:145: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class F’, got ‘template<<typeprefixerror>...<anonymous> > class F’
prog.cpp:168:145: error: template argument 4 is invalid
prog.cpp:170:25: error: ‘auto’ parameter not permitted in this context
 template <template <auto...> class F, std::size_t End, typename Output, typename... Packs>
                         ^~~
prog.cpp:171:49: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class F, long unsigned int N, long unsigned int End, class Output, class ... Packs> struct transform_h’
 struct transform_h<F, End, End, Output, Packs...> : detail::identity<Output> {};
                                                 ^
prog.cpp:171:49: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class F’, got ‘template<<typeprefixerror>...<anonymous> > class F’
prog.cpp:173:41: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyPack, template <auto, auto> class Comparator, template <auto...> class F, typename... Packs>
                                         ^~~~
prog.cpp:173:47: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyPack, template <auto, auto> class Comparator, template <auto...> class F, typename... Packs>
                                               ^~~~
prog.cpp:173:85: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyPack, template <auto, auto> class Comparator, template <auto...> class F, typename... Packs>
                                                                                     ^~~
prog.cpp:174:141: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator, <typeprefixerror>...<anonymous> > struct detail::extreme_value’
 using do_transform = output_h<EmptyPack, typename transform_h<F, 0, detail::extreme_value<Comparator, detail::sequence_size<Packs>::value...>::value, typename detail::empty_pack<Packs...>::type, Packs...>::type>;
                                                                                                                                             ^
prog.cpp:174:141: note:   expected a template of type ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’, got ‘template<<typeprefixerror><anonymous>, <typeprefixerror><anonymous> > class Comparator’
prog.cpp:174:141: note: invalid template non-type parameter
prog.cpp:174:204: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class F, long unsigned int N, long unsigned int End, class Output, class ... Packs> struct transform_h’
 using do_transform = output_h<EmptyPack, typename transform_h<F, 0, detail::extreme_value<Comparator, detail::sequence_size<Packs>::value...>::value, typename detail::empty_pack<Packs...>::type, Packs...>::type>;
                                                                                                                                                                                                            ^
prog.cpp:174:204: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class F’, got ‘template<<typeprefixerror>...<anonymous> > class F’
prog.cpp:174:204: error: template argument 3 is invalid
prog.cpp:174:211: error: template argument 2 is invalid
 using do_transform = output_h<EmptyPack, typename transform_h<F, 0, detail::extreme_value<Comparator, detail::sequence_size<Packs>::value...>::value, typename detail::empty_pack<Packs...>::type, Packs...>::type>;
                                                                                                                                                                                                                   ^
prog.cpp:176:45: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyPack, template <auto...> class F, typename... Packs>
                                             ^~~
prog.cpp:177:63: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
 struct combine_packs_h<Transform, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, less_than, F, Packs...> {};
                                                               ^
prog.cpp:177:63: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<<typeprefixerror>...<anonymous> > class F’
prog.cpp:177:74: error: template argument 3 is invalid
 struct combine_packs_h<Transform, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, less_than, F, Packs...> {};
                                                                          ^
prog.cpp:177:90: error: expected template-name before ‘<’ token
 struct combine_packs_h<Transform, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, less_than, F, Packs...> {};
                                                                                          ^
prog.cpp:179:45: error: ‘auto’ parameter not permitted in this context
 template <typename EmptyPack, template <auto...> class F, typename... Packs>
                                             ^~~
prog.cpp:180:68: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
 struct combine_packs_h<TransformToEnd, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, greater_than, F, Packs...> {};
                                                                    ^
prog.cpp:180:68: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<<typeprefixerror>...<anonymous> > class F’
prog.cpp:180:79: error: template argument 3 is invalid
 struct combine_packs_h<TransformToEnd, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, greater_than, F, Packs...> {};
                                                                               ^
prog.cpp:180:95: error: expected template-name before ‘<’ token
 struct combine_packs_h<TransformToEnd, EmptyPack, functor_wrapper<F>, Packs...> : do_transform<EmptyPack, greater_than, F, Packs...> {};
                                                                                               ^
prog.cpp: In instantiation of ‘struct detail::sequence_traits<Z<0, 1, 2, 3> >’:
prog.cpp:36:9:   required from ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<> >’
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, Z<0, 1, 2, 3>, Q<4, 5, 6>, R<> >’
prog.cpp:221:50:   required from here
prog.cpp:36:9: error: invalid use of incomplete type ‘struct detail::sequence_traits<Z<0, 1, 2, 3> >’
  struct sequence_traits<First, Rest...> : sequence_traits<First> {};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:36:9: note: declaration of ‘struct detail::sequence_traits<Z<0, 1, 2, 3> >’
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)0u, Z<0, 1, 2, 3>, Q<4, 5, 6>, R<> >’:
prog.cpp:221:50:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp: In function ‘int main()’:
prog.cpp:223:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)0u, Z<0, 1, 2, 3>, Z<4, 5, 6> >’:
prog.cpp:226:45:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:228:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)0u, Z<0, 1, 2, 3>, Q<4, 5, 6>, R<7, 8> >’:
prog.cpp:231:53:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<7, 8> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<7, 8> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, R<7, 8> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:233:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >’
prog.cpp:236:53:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:238:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >’
prog.cpp:241:81:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:243:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct detail::sequence_traits<detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul> >’:
prog.cpp:36:9:   required from ‘struct detail::sequence_traits<detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, I<> >’
prog.cpp:138:8:   required from ‘struct combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, I<> >’
prog.cpp:200:34:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, I<> >’
prog.cpp:246:112:   required from here
prog.cpp:36:9: error: invalid use of incomplete type ‘struct detail::sequence_traits<detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul> >’
  struct sequence_traits<First, Rest...> : sequence_traits<First> {};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:36:9: note: declaration of ‘struct detail::sequence_traits<detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul> >’
prog.cpp: In instantiation of ‘struct combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, I<> >’:
prog.cpp:200:34:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, I<> >’
prog.cpp:246:112:   required from here
prog.cpp:138:8: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, I<> >’
 struct combine_packs_h<Merge, EmptyPack, First, Rest...> : combine_packs_h<Merge, EmptyPack, First, typename combine_packs_h<Merge, typename detail::sequence_traits<Rest...>::template_empty, Rest...>::type> {};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, I<> >’:
prog.cpp:246:112:   required from here
prog.cpp:200:34: error: no type named ‘type’ in ‘using meta = std::conditional_t<false, combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul> >, combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, I<> > > {aka struct combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, I<> >}’
  using type = typename meta::type;
                                  ^
prog.cpp:248:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, std::integer_sequence<long unsigned int> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, std::integer_sequence<long unsigned int> >’
prog.cpp:251:125:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:253:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, std::integer_sequence<long unsigned int, 9ul> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, std::integer_sequence<long unsigned int, 9ul> >’
prog.cpp:256:95:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int, 9ul> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:258:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul>, I<> >’:
prog.cpp:200:34:   required from ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, std::integer_sequence<long unsigned int, 9ul>, I<> >’
prog.cpp:261:135:   required from here
prog.cpp:138:8: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul>, I<> >’
 struct combine_packs_h<Merge, EmptyPack, First, Rest...> : combine_packs_h<Merge, EmptyPack, First, typename combine_packs_h<Merge, typename detail::sequence_traits<Rest...>::template_empty, Rest...>::type> {};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)0u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, std::integer_sequence<long unsigned int, 7ul, 8ul>, std::integer_sequence<long unsigned int, 9ul>, I<> >’:
prog.cpp:261:135:   required from here
prog.cpp:200:34: error: no type named ‘type’ in ‘using meta = std::conditional_t<false, combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul> >, combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul>, I<> > > {aka struct combine_packs_h<(CombineType)0u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul> >::Q<0ul, 1ul, 2ul, 3ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul> >::Q<4ul, 5ul, 6ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 7ul, 8ul> >::Q<7ul, 8ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul>, I<> >}’
  using type = typename meta::type;
                                  ^
prog.cpp:263:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)0u, I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’
prog.cpp:266:95:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp: In instantiation of ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul> >’:
prog.cpp:36:9:   required from ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)0u, I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’
prog.cpp:266:95:   required from here
prog.cpp:36:9: error: invalid use of incomplete type ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul> >’
  struct sequence_traits<First, Rest...> : sequence_traits<First> {};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:36:9: note: declaration of ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul> >’
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)0u, I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’:
prog.cpp:266:95:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<I<0ul, 1ul, 2ul, 3ul>, I<4ul, 5ul, 6ul>, I<7ul, 8ul>, I<9ul>, std::integer_sequence<long unsigned int> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:268:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)1u, Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9> >’:
prog.cpp:271:67:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:273:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)1u, Z<0, 1, 2, 3>, Q<4, 5, 6>, Z<7, 8>, R<9> >’:
prog.cpp:276:67:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, Z<7, 8>, R<9> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, Z<7, 8>, R<9> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Q<4, 5, 6>, Z<7, 8>, R<9> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:278:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)1u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, I<7ul, 8ul>, std::integer_sequence<long unsigned int, 9ul> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)1u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, std::integer_sequence<long unsigned int, 4ul, 5ul, 6ul>, I<7ul, 8ul>, std::integer_sequence<long unsigned int, 9ul> >’
prog.cpp:281:121:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int, 9ul> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:283:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)1u, Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9>, Q<> >’:
prog.cpp:286:72:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9>, Q<> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9>, Q<> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2, 3>, Z<4, 5, 6>, Z<7, 8>, Z<9>, Q<> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:288:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)1u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, I<4ul, 5ul, 6ul>, Z<7, 8>, std::integer_sequence<long unsigned int, 9ul>, I<> >’:
prog.cpp:291:108:   required from here
prog.cpp:200:34: error: no type named ‘type’ in ‘using meta = std::conditional_t<false, combine_packs_h<(CombineType)1u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul> >::Q<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, I<4ul, 5ul, 6ul>, Z<7, 8>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul> >, combine_packs_h<(CombineType)1u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul> >::Q<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, I<4ul, 5ul, 6ul>, Z<7, 8>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul>, I<> > > {aka struct combine_packs_h<(CombineType)1u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul> >::Q<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, I<4ul, 5ul, 6ul>, Z<7, 8>, detail::simple_pack<std::integer_sequence<long unsigned int, 9ul> >::Q<9ul>, I<> >}’
  using type = typename meta::type;
                                  ^
prog.cpp:293:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)1u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, R<4, 5, 6>, Z<7, 8>, I<9ul>, std::integer_sequence<long unsigned int> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)1u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, R<4, 5, 6>, Z<7, 8>, I<9ul>, std::integer_sequence<long unsigned int> >’
prog.cpp:296:121:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:298:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct detail::sequence_traits<Z<0, 1, 2> >’:
prog.cpp:36:9:   required from ‘struct detail::sequence_traits<Z<0, 1, 2>, Z<3, 4, 5>, Z<6, 7, 8> >’
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)2u, Z<0, 1, 2>, Z<3, 4, 5>, Z<6, 7, 8> >’
prog.cpp:301:57:   required from here
prog.cpp:36:9: error: invalid use of incomplete type ‘struct detail::sequence_traits<Z<0, 1, 2> >’
  struct sequence_traits<First, Rest...> : sequence_traits<First> {};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:36:9: note: declaration of ‘struct detail::sequence_traits<Z<0, 1, 2> >’
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)2u, Z<0, 1, 2>, Z<3, 4, 5>, Z<6, 7, 8> >’:
prog.cpp:301:57:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2>, Z<3, 4, 5>, Z<6, 7, 8> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2>, Z<3, 4, 5>, Z<6, 7, 8> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2>, Z<3, 4, 5>, Z<6, 7, 8> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:303:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)2u, Z<0, 1, 2>, Q<3, 4>, R<5, 6, 7, 8, 9, 10> >’:
prog.cpp:306:62:   required from here
prog.cpp:197:121: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2>, Q<3, 4>, R<5, 6, 7, 8, 9, 10> >’
  using EmptyPack = std::conditional_t<LastPackIsEmpty, Last, typename detail::sequence_traits<Packs...>::template_empty>;  // Change this if first pack is a Functor
                                                                                                                         ^
prog.cpp:198:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2>, Q<3, 4>, R<5, 6, 7, 8, 9, 10> >’
  using pack = combine_packs_h<C, EmptyPack, typename detail::simple_pack<Packs>::type...>;
                                                                                          ^
prog.cpp:199:90: error: no type named ‘template_empty’ in ‘struct detail::sequence_traits<Z<0, 1, 2>, Q<3, 4>, R<5, 6, 7, 8, 9, 10> >’
  using meta = std::conditional_t<LastPackIsEmpty, typename remove_last<pack>::type, pack>;
                                                                                          ^
prog.cpp:308:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘constexpr const bool combine_packs<(CombineType)2u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul>, I<3ul, 4ul>, std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::LastPackIsEmpty’:
prog.cpp:197:121:   required from ‘struct combine_packs<(CombineType)2u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul>, I<3ul, 4ul>, std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >’
prog.cpp:311:98:   required from here
prog.cpp:196:24: error: incomplete type ‘detail::is_empty<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >’ used in nested name specifier
  static constexpr bool LastPackIsEmpty = detail::is_empty<Last>::value;
                        ^~~~~~~~~~~~~~~
prog.cpp:313:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp: In instantiation of ‘struct combine_packs_h<(CombineType)2u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul> >::Q<0ul, 1ul, 2ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 3ul, 4ul> >::Q<3ul, 4ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::Q<5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> >’:
prog.cpp:200:34:   required from ‘struct combine_packs<(CombineType)2u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul>, std::integer_sequence<long unsigned int, 3ul, 4ul>, std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> >’
prog.cpp:316:121:   required from here
prog.cpp:158:8: error: invalid use of incomplete type ‘struct interlace<detail::simple_pack<std::integer_sequence<long unsigned int> >::Q<>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul> >::Q<0ul, 1ul, 2ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 3ul, 4ul> >::Q<3ul, 4ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::Q<5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> >’
 struct combine_packs_h<Interlace, EmptyPack, Packs...> : output_h<EmptyPack, typename interlace<typename detail::simple_pack<EmptyPack>::type, Packs...>::type> {};
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:146:54: note: declaration of ‘struct interlace<detail::simple_pack<std::integer_sequence<long unsigned int> >::Q<>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul> >::Q<0ul, 1ul, 2ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 3ul, 4ul> >::Q<3ul, 4ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::Q<5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> >’
 template <typename Output, typename... Packs> struct interlace;
                                                      ^~~~~~~~~
prog.cpp: In instantiation of ‘struct combine_packs<(CombineType)2u, std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul>, std::integer_sequence<long unsigned int, 3ul, 4ul>, std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> >’:
prog.cpp:316:121:   required from here
prog.cpp:200:34: error: no type named ‘type’ in ‘using meta = std::conditional_t<false, combine_packs_h<(CombineType)2u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul> >::Q<0ul, 1ul, 2ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 3ul, 4ul> >::Q<3ul, 4ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::Q<5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >, combine_packs_h<(CombineType)2u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul> >::Q<0ul, 1ul, 2ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 3ul, 4ul> >::Q<3ul, 4ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::Q<5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> > > {aka struct combine_packs_h<(CombineType)2u, std::integer_sequence<long unsigned int>, detail::simple_pack<std::integer_sequence<long unsigned int, 0ul, 1ul, 2ul> >::Q<0ul, 1ul, 2ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 3ul, 4ul> >::Q<3ul, 4ul>, detail::simple_pack<std::integer_sequence<long unsigned int, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul> >::Q<5ul, 6ul, 7ul, 8ul, 9ul, 10ul>, I<> >}’
  using type = typename meta::type;
                                  ^
prog.cpp:318:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp:321:47: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
   combine_packs<Transform, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, Z<1,2,-1,3,1>>::type,
                                               ^
prog.cpp:321:47: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<int A, int B, int C> struct foo’
prog.cpp:321:96: error: template argument 2 is invalid
   combine_packs<Transform, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, Z<1,2,-1,3,1>>::type,
                                                                                                ^~
prog.cpp:323:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp:326:52: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
   combine_packs<TransformToEnd, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, Z<1,2,-1,3,1>>::type,
                                                    ^
prog.cpp:326:52: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<int A, int B, int C> struct foo’
prog.cpp:326:101: error: template argument 2 is invalid
   combine_packs<TransformToEnd, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, Z<1,2,-1,3,1>>::type,
                                                                                                     ^~
prog.cpp:328:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp:331:47: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
   combine_packs<Transform, functor_wrapper<foo>, Q<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, R<1,2,-1,3,1>>::type,
                                               ^
prog.cpp:331:47: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<int A, int B, int C> struct foo’
prog.cpp:331:96: error: template argument 2 is invalid
   combine_packs<Transform, functor_wrapper<foo>, Q<2,4,-2,6,2,2,2>, Z<5,10,-5,15>, R<1,2,-1,3,1>>::type,
                                                                                                ^~
prog.cpp:333:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp:336:52: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
   combine_packs<TransformToEnd, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Q<5,10,-5,15>, R<1,2,-1,3,1>, R<>>::type,
                                                    ^
prog.cpp:336:52: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<int A, int B, int C> struct foo’
prog.cpp:336:106: error: template argument 2 is invalid
   combine_packs<TransformToEnd, functor_wrapper<foo>, Z<2,4,-2,6,2,2,2>, Q<5,10,-5,15>, R<1,2,-1,3,1>, R<>>::type,
                                                                                                          ^~
prog.cpp:338:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp:341:47: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
   combine_packs<Transform, functor_wrapper<foo>, std::index_sequence<2,4,-2,6,2,2,2>, std::index_sequence<5,10,-5,15>, std::index_sequence<1,2,-1,3,1>>::type,
                                               ^
prog.cpp:341:47: note:   expected a template of type ‘template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1>’, got ‘template<int A, int B, int C> struct foo’
prog.cpp:341:150: error: template argument 2 is invalid
   combine_packs<Transform, functor_wrapper<foo>, std::index_sequence<2,4,-2,6,2,2,2>, std::index_sequence<5,10,-5,15>, std::index_sequence<1,2,-1,3,1>>::type,
                                                                                                                                                      ^~
prog.cpp:343:2: error: template argument 1 is invalid
  >::value << '\n';  // true
  ^
prog.cpp:346:52: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<<typeprefixerror>...<anonymous> > class<template-parameter-1-1> > struct functor_wrapper’
   combine_packs<TransformToEnd, functor_wrapper<foo>, std::index_sequence<2,4,-2,6,2,2,2>, I<5,10,-5,15>, std::index_sequence<1,2,-1,3,1>, I<>>::type,
                                                    ^
prog.cpp:346:52: note:   expected a template of type ‘template
stdout
Standard output is empty