cppreference writes that a template parameter pack is a template parameter:
https://en.cppreference.com/w/cpp/language/parameter_pack
Is it true? For example, is it correct to write something like this:
template<typename... Ts>
class MyClass {
std::unique_ptr<Ts...> m_data;
};
Yes, a parameter pack is a valid template parameter, to use in a declaration. But when a template is instantiated, it is replaced with a list of actually supplied template arguments, see https://en.cppreference.com/w/cpp/language/template_parameters
E.g. in your example MyClass<int>
will contain std::unique_ptr<int>
, MyClass<int, MyDeleter>
will contain std::unique_ptr<int, MyDeleter>
and MyClass<int, MyDeleter, Foo>
will cause a compiler error "wrong number of template arguments", because std::unique_ptr
may have at most two of them.