templated math library c++