I have a weird typedef statement in a C++ program, generated by Py++.
double radius(int); // function to be wrapped
typedef double (*radius_function_type)(int);
bp::def("radius", radius_function_type(&radius)); // bp::def is a function for wrapping
What I figured out so far is that the above typedef statemnt is not of the type, most of us are familiar with,
typedef complex_type simple_alias;
Rather it is a way to declare pointer to a function which takes int as argument and returns double (same as the prototype). So my question now is that, how come pointer to a function (without dereferencing) be called with address of a function as an argument? This also doesn't match with the prototype. Somebody please explain!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…