How to make a specialisation for a template function with returning value template?
I tried this:
myfunc.h:
#pragma once
template< >
int MyFunc<int>(){
return 10;
}
main.cpp:
#include "myfunc.h"
int main()
{
int a;
a = MyFunc<int>();
return 0;
}
but i have error: expected initializer before ‘<‘ token
You are missing the primary template before you declare your specialization.
Please be aware of the problems of function specializations.