Just fix your syntax a bit - since the template template parameter is set incorrectly, we get something like this:
template <typename T, template <T > class Z, T Value> // ^^^^^^^^^^^^^^^^^^^^^ void foo(Z<Value> x) { }
However, the compiler cannot output T here - this is not an inferred context. You must explicitly provide it:
foo<int>(XX<1>{});
This is pretty annoying. I can't even write a type trait so that non_type_t<XX<1>> an int (where this type indicates the actual introspection of the type, and not something that int trivially returns).
There is a proposal to improve this process ( P0127 ) by amending the non-deducible context of non-piggy type template arguments,
Barry source share