I saw a blog post which used non-type variadic templates (currently not supported by gcc, only by clang).
template stru
This will print out all elements, get max could be implemented similarly
template void foo(){ cout << N << endl; } template void foo(){ cout << N << endl; foo(); } int main(){ foo<1, 5, 7>(); return 0; }