-1
I have this template below, and when I try to call with the excerpt below, it can’t find the reference
template<typename T> double power(T base, T power) {
double result = base;
int j = 0;
do {
result *= base;
j++;
} while (j < (power - 1));
return result;
}
And that’s the call:
test_log << "Expected: 27 | Output: " << power(3, 3) << endl; //Expected: 27
test_log << "Expected: 81 | Output: " << power(9, 0.5) << endl; //Expected: 81
The template is in a namespace, but I put "using namespace smath" at the beginning of the call file.
I’m using Mingw on Windows 10 20h2 with Clion 2021.1