How do I typedef a function pointer with the C++11 using syntax?

It has a similar syntax, except you remove the identifier from the pointer:

using FunctionPtr = void (*)();

Here is an Example

If you want to “take away the uglyness”, try what Xeo suggested:

#include <type_traits>

using FunctionPtr = std::add_pointer<void()>::type;

And here is another demo.

Leave a Comment

tech