c++ - How to declare a pointer to a function of return type X and input parameter A? -
what general form of declaring pointer function which, of return type x , accepts input parameter &y?
is it:
x my_function(y &y){ //code } x (*my_pointer) (y &y) = my_function;
?
x (*fptr)(y&) = my_function;
or:
auto fptr = my_function; // c++11
or:
std::function<x(y&)> fptr(my_function); // c++11, boost::function if not
Comments
Post a Comment