弑天下
使用C ++ 11:#include <map>using namespace std;map<int, char> m = {{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}};使用Boost.Assign:#include <map>#include "boost/assign.hpp"using namespace std;using namespace boost::assign;map<int, char> m = map_list_of (1, 'a') (3, 'b') (5, 'c') (7, 'd');