Difference in using function type vs function pointer as C++ template function parameter? -


Something related but I could not get rid of all my doubts.

What is, if any,

  template & lt; Void F (int) & gt; Void fun1 (int a) {f (a);}  

and

  template & lt; Void (* F) (int) & gt; Void fun2 (int a) {f (a);}  

?

I tried to start something like both

  called zero (int arg) {...} int main () {joy 1 (10); Fun2 (20); Return 0; }  

And seeing the assembly code generated by both Kleng 3.4 and GCC-4.8 (both for OOs), I do not make any difference to me.

I know that the name of a pane is passed on as an argument for any type of indicator, but there is no clear explanation about it, when the template in the form of it immediately I used to say that in the first template, there is a type of "something" in the template, which can be said with the argument of int and nothing returns, whereas in the second template "f" such "something" For one Is the indicator and in both implementations, the use of F can be done in the same way as it is used both directly and through function pointer while using the name of a function. I think that it is strictly related to how the names of the function are decayed in the signals, but I am somewhat confused about which part of this standard is formalized.

A non-type template-parameter type "array < Code> T "or" returning function T "is adjusted to work like" pointer to T "or" returning function .


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -