Non-type variadic function templates in C++11
This will print out all elements, get max could be implemented similarly template <int N> void foo(){ cout << N << endl; } template <int N, int M, int … Rest> void foo(){ cout << N << endl; foo<M, Rest…>(); } int main(){ foo<1, 5, 7>(); return 0; }