B
Boris Glawe
Hi,
How can I declare the type of pointer to a function ??
I want to create a map (from STL), which contains pointers to functions
as values, but I have to declare the type:
void print_red(){
cout << "red" << endl;
}
void print_green(){
cout << "green" << endl;
}
void print_blue(){
cout << "blue" << endl;
}
map <string, "pointer to a function"> m;
m["red"] = print_red;
m["green"] = print_green;
m["blue"] = print_blue;
How can I specify the type of this function. The same problem exists
when you want to declare a function, which take a pointer to another
function as an argument.
How can this be done??
Thanks Boris
How can I declare the type of pointer to a function ??
I want to create a map (from STL), which contains pointers to functions
as values, but I have to declare the type:
void print_red(){
cout << "red" << endl;
}
void print_green(){
cout << "green" << endl;
}
void print_blue(){
cout << "blue" << endl;
}
map <string, "pointer to a function"> m;
m["red"] = print_red;
m["green"] = print_green;
m["blue"] = print_blue;
How can I specify the type of this function. The same problem exists
when you want to declare a function, which take a pointer to another
function as an argument.
How can this be done??
Thanks Boris