im working on converting C code to c++ , in one section of the code i have something like function array in C that looks like:
this is how C looks like :
void func1(bool a)
{
..
}
void func2(bool a)
{
..
}
void func3(bool a)
{
..
}
struct func
{
void (*f)(incoming *);
int arg_length;
};
typedef struct func func;
func funcs[] = {
{ func1, 4 },
{ func2, 10 },
{ func3, 4 }
};
how can it converted to c++?
UPDATE:
question: is this is valid answer for none static function pointers ?
http://www.newty.de/fpt/fpt.html#chapter2
also can i define Array of different types of member function pointer?
您可以定义一个类,并插入“ []”运算符以获取指向函数的指针。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.