I tried to understand the error but no idea. The map looks like this:
std::map<std::string, IOperand *(Factory::*)(const std::string &)> _func
And trying to give the value like this:
_func["int8"] = &Factory::createInt8;
And how is my class:
class Factory
{
public:
Factory();
~Factory();
static IOperand *createOperand(eOperandType type, const std::string &value);
private:
std::map<std::string, IOperand *(Factory::*)(const std::string &)> _func;
static IOperand *createInt8(const std::string &value);
static IOperand *createInt16(const std::string &value);
static IOperand *createInt32(const std::string &value);
static IOperand *createFloat(const std::string &value);
static IOperand *createDouble(const std::string &value);
static IOperand *createBigDecimal(const std::string &value);
};
And the error:
Assigning to 'std::map<std::__cxx11::basic_string<char>, IOperand *(Factory::*)(const std::__cxx11::basic_string<char> &), std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, IOperand *(Factory::*)(const std::__cxx11::basic_string<char> &)> > >::mapped_type' (aka 'IOperand *(Factory::*)(const std::__cxx11::basic_string<char> &)') from incompatible type 'IOperand *(*)(const std::string &)' (aka 'IOperand *(*)(const basic_string<char> &)')
The error is in assigning the value.
IOperand *(*)(const std::string &), notIOperand *(Factory::*)(const std::string &). What does prevent your from changing the map declaration?