C++ - 如何编写函数指针指向的类型
C++ - how to write the type pointed to by a function pointer
函数指针指向的东西的类型怎么写?
换句话说,我可以这样得到它的类型:
#include <type_traits>
typedef std::remove_pointer<void(*)(int)>::type func;
但是不使用std::remove_pointer<>
怎么写类型func
的名字呢?
与using
:
using func = void(int);
与typedef
:
typedef void(func)(int);
其中一个肯定比另一个好。
函数指针指向的东西的类型怎么写?
换句话说,我可以这样得到它的类型:
#include <type_traits>
typedef std::remove_pointer<void(*)(int)>::type func;
但是不使用std::remove_pointer<>
怎么写类型func
的名字呢?
与using
:
using func = void(int);
与typedef
:
typedef void(func)(int);
其中一个肯定比另一个好。