include iostream include map include string const std pair std string

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <iostream>
#include <map>
#include <string>
const std::pair<std::string, std::string> _map_init[] = {
std::make_pair("fruit", "apple"),
std::make_pair("language", "c") };
const std::map<std::string, std::string> map(
_map_init, _map_init + sizeof(_map_init) / sizeof(_map_init[0]));
int main()
{
std::cout << map.find("fruit")->second << std::endl;
}