In C++ you can create templates using a non-type template parameter like this:
template< int I > void add( int& value ) { value += I; } int main
There are lots of reasons, like doing template metaprogramming (check Boost.MPL). But there is no need to go that far, C++11's std::tuple has an accessor std::get that needs to be indexed at compile time, since the result is dependent on the index.
std::tuple
std::get