You seem to have an C++03 compiler, since that should compile in C++11.
Since error_code_entry_t
is the value_type
of your map, it is in fact a std::pair<const in, const char*>
(Yes, the const for the key type is correct). That is not an aggregate, so you cannot initialize it like that. To fix the error at hand, you could try the following:
const error_code_entry_t error_code_tbl_[] = {
error_code_entry_t( ERR_OK , "ERR_OK" ),
error_code_entry_t( ERR_RT_OUT_OF_MEMORY, "ERR_RT_OUT_OF_MEMORY" ),
// ...
};
But since you want to put them into a map anyways, I'd consider boost.assign:
#include <boost/assign/list_of.hpp>
const error_code_tbl_t error_code_tbl = boost::assign::map_list_of
(ERR_OK , "ERR_OK")
(ERR_RT_OUT_OF_MEMORY, "ERR_RT_OUT_OF_MEMORY")
;