#include using namespace std; template T shiftleft(T &x1) { return x1; } // Params (below) is a parameter pack. There are two operations: // Params... "unpacks" the types into a list // sizeof...(Params) is the number of elements in that list template T shiftleft(T &x1, Params &... xs) { T ret = x1; x1 = shiftleft(xs...); return ret; } int main(int argc, char **argv) { int a=1,b=2; char c='3'; double d=4.0,e=5.0; cout << shiftleft(a,b,c,d,e) << endl; cout << "a=" << a << endl; cout << "b=" << b << endl; cout << "c=" << c << endl; cout << "d=" << d << endl; cout << "e=" << e << endl; }