October 2011
Beginner to intermediate
1200 pages
35h 33m
English
As a starting point to see how parameter packs work, let’s consider a simple template function, one that displays a list consisting of just one item:
template<typename T>void show_list0(T value){ std::cout << value << ", ";}
This definition has two parameter lists. The template parameter list is just T. The function parameter list is just value. A function call such as the following sets T in the template parameter list to double and value in the function parameter list to 2.15:
show_list0(2.15);
C++11 provides an ellipsis meta-operator that enables you to declare an identifier for a template parameter pack, essentially a list of types. Similarly, it lets you declare an identifier for a function parameter ...
Read now
Unlock full access