#include #include #include #include template void print(std::map s) { for(auto it = s.cbegin(); it!=s.cend(); it++) std::cout << it->first << " -> " << std::hex << std::uppercase << "0x" << it->second << std::endl; } int main(int argc, char *argv[]) { std::map colormap; colormap.insert(std::pair(std::string("orange"), 0xFF8C00 )); colormap.insert(std::pair(std::string("green"), 0x008C00 )); colormap.insert(std::pair(std::string("blue"), 0x0000FF )); colormap.insert(std::make_pair(std::string("red"), 0x8C0000 )); colormap.insert(std::make_pair(std::string("cyan"), 0x00FFFF)); colormap.insert(std::make_pair(std::string("orange"), 0xFF6347 )); colormap.emplace(std::string("blue"), 0x0000AA ); colormap.emplace(std::string("purple"), 0x9400D3 ); colormap.emplace(std::string("magenta"), 0xFF00FF ); print(colormap); return 0; }