型は関数型です。今まではポインタ型でしか使用されていなかったので、あまり慣れていないかもしれません:
typedef int (ft)(void); //Huh? (raw function type)
typedef ft *fp; //??? (pointer to function)
typedef int (*fp_oldstyle)(void);//Ahh... (same as fp)
Functions themselves do have types, but since you cannot declare variables of that type or references to it, the only thing you would typically use are pointers, which are declared in the familiar syntax on the last line. For any function int foo(void);
, both foo
and &foo
are interpreted as the pointer, so the "raw" function type ft
isn't needed.
しかし、 std :: function
、 std :: bind
、およびlambdaを取り巻く新しいテンプレートマジックでは、テンプレートパラメータで裸関数の型を見るのがはるかに一般的なことです。