I remember that when using Boost.Spirit and for the std::function addition to C++0x, you specify the function type by using a syntax that doesn’t use pointers, like in defining std::function<bool(int)> fn, whereas you would cast a pointer like (bool(*)(int))fn.
Can anyone tell me the name of this new syntax or any references on this, or how to use it? It seems like a polymorphic function type syntax that applies for functors as well, but I don’t really know how to use it.
bool(int)is the type of the function;bool(*)(int)is the type of the function pointer. In other words, if you definethen
BF*is the same aspBF.The
std::functiontemplate captures the return and argument types via (variadic) templates: