C++ Call pointer to member with a map from a const function
问题 I have a map of pointer to member declared as : std::map<char, T (Operand::*)(const T &, const T &)> op_map; I fill my map with pointer to member directly in the constructor of my class with : op_map['+'] = &Operand::op_add; For example, op_add source code is : T op_add(const T & a, const T & b) { return a + b; } And I want to call my pointer to member from a const function. Here is the source code : IOperand *res_int32(char op, const IOperand & rhs) const { IOperand *res = const_cast