1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <map>
#include <set>
int main()
{
std::set<std::string> s { "elem1", "elem2", "elem3" };
std::map<std::string, std::set<std::string>> data;
data.insert(std::make_pair("KEY", s));
data.insert(std::make_pair("KEY1", s));
for (auto& i : data) {
std::cout << i.first << ": ";
std::string delim;
for (auto& s : i.second) {
std::cout << delim << s;
delim = ", ";
}
std::cout << std::endl;
}
return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
clang++ -std=c++11 -O2 -Wall -pedantic -pthread main.cpp && ./a.out
KEY: elem1, elem2, elem3
KEY1: elem1, elem2, elem3