I know void(*)(int) is a function pointer. But I'm really confused of void(int). First, they're different types
using A = void(int);
using B = void(*)(int);
is_same<A*, B>::value == true
I can initialize a variable of type B using a function pointer but not A
void func(int x){
cout<<x<<endl;
}
B b { func }; //ok
A a { func }; //error
A* ap { func }; //ok
But if used as function parameter types, they seem to be exchangable
void callA(A a, int arg){ a(arg); }
void callB(B b, int arg){ b(arg); }
callA(func, 1); //ok
callB(func, 1); //ok
So what is void(int) indeed? When should I use void(int) and when should I use void(*)(int)?