Tür bir işlev türüdür. Bu kadar tanıdık olmayabilir, çünkü şu ana kadar sadece işaretçi türlerinde kullanılmıştır:
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.
Ancak, std :: function
, std :: bind
ve lambda'ları çevreleyen yeni şablon sihirbazıyla, şablon parametrelerinde çıplak işlev türlerini görmek artık çok daha yaygın bir şeydir. .