Random
Source Code

templatized

C++ code that is written with template parameters. In particular, allows data types and software algorithms to be easily changed.

// power() is templatized by P and T
template<int P, typename T>
T power(int a)
{

T val = 1;

for (int i=0; i<P; i++)

val = val * val;

return val;
}

by Zack63 November 12, 2010

10👍 1👎