Seen from the introduction http://en.cppreference.com/w/cpp/language/parameter_pack, seems the concept of "parameter pack" is something the same as "variadic template". So what's the conceptual difference between them?
Thanks!
Syntactically, parameter pack is a part of a variadic template. For example,
template<class ... Types> struct Tuple {};
is a variadic structure template, and Types is a parameter pack in it. Tuple itself is not a parameter pack.
You may pass any set of type parameters to Tuple, and they will be packed to Types pack. For example in the code
Tuple<int, float, std::string> foo;
we instantiated a Tuple template with int, float and string types and got a structure of actual type Tuple<int, float, std::string>. The code of Tuple may now expand Types pack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With