C++ Template Metaprogramming and Polynomial-Time Functions