Partially related to C ++ Template Syntax with function type parameters , but could not get rid of all my doubts.
What is, if there is, the difference between
template <void F(int)>
void fun1 (int a) {F(a);}
and
template <void (*F)(int)>
void fun2 (int a) {F(a);}
?
I tried to create an instance with something like
void called (int arg)
{
...
}
int main()
{
fun1(10);
fun2(20);
return 0;
}
And looking at the generated assembly code from clang 3.4 and gcc-4.8 (-O0 for both), I did not see any difference.
, , , , , .
, "F" - "-", int , "F" - "-", F , , .
, , , , .