0

I hope the following example is less convoluted than the title!

Suppose we have a few metafunctions; a Trait, ReversePartial which binds the types in a parameter pack to the back of a variadic class template, and a Test sink which accepts the resulting alias template.

template<typename, typename...>
struct Trait : std::true_type {};

template<template<typename...> typename Template, typename... Ts>
struct ReversePartial
{
    template<typename... Us>
    using Apply = Template<Us..., Ts...>;
};

template<template<typename...> typename>
struct Test {};

Why are we able to compile when explicitly specifying the types to be applied

using T = Test<ReversePartial<Trait, int, double>::Apply>; // compiles

but not when passing them via a parameter pack?

error: template argument for template template parameter must be a class template or type alias template

template<typename... Ts>
using U = Test<ReversePartial<Trait, Ts...>::Apply>; // does not compile

Is there a workaround to achieve this?

Try on Compiler Explorer

invexed
  • 645
  • 3
  • 10

0 Answers0