I have a template function taking a function pointer as an argument, and a normal function like so:
template <void()>
int foo() {static int c = 0; return ++c;}
void bar() {}
If I understand correctly, two different function pointers can have different binary representations, even if using them would call the same function. Does this also apply to when they are used as template arguments?
Will passing "pointers to bar
" (obtained at different times from different places, but calling the function pointer would call bar
) to foo
always call the same instantiation of foo
?