Hi folks,
I am trying to add a default argument to a template function in a
template class, here is the code snippet:
template<typename T>
class Test {
template<typename U>
friend void doSomething(U level);
};
template<typename U>
void doSomething(U level = 0) {
cout << "Here I am doing something\n";
}
int main() {
doSomething();
}
An error araise at the compile time:
error C2783: 'void doSomething(U)' : could not deduce template
argument for 'U'
How can I define such a template function taking a default argument?
Thank you.