c++ - difference between function parameters -
in parameter's of function, want pass default argument function template. i'm trying decipher difference between (*cmp) or (cmp) in function below:
template <typename type> int foo(some var, int (*cmp)(type one, type two) = functtemplate) { ...
i used seeing * pointer declaration... pointer function functtemplate? why program see work regardless of way write (astrik or no astrik)?
the types not same, there no difference when used parameter type in function declaration.
in int (*cmp)(type, type)
, cmp
has pointer-to-function type (or "function pointer" type).
in int (cmp)(type, type)
, cmp
has function type (i.e., not pointer type @ all).
however, c , c++ both have rule parameter has function type implicitly converted corresponding function pointer type, parameter has array type implicitly converted corresponding pointer type.
Comments
Post a Comment