我想做这样的事情:
int a = 9, b = 3;
map<char,operator> m;
m['+'] = +;
m['-'] = -;
m['*'] = *;
m['/'] = /;
for(map<char,operator>::iterator it = m.begin(); it != m.end(); ++it) {
cout << func(a,b,it -> second) << endl;
}
输出是这样的:
12
6
27
3
我该怎么做?