std::unordered_multimap
cppreference.com
Example
print_map: (comment: std::string_view, data) = {
std::cout << comment;
for data do (pair) {
std::cout << " (pair.first)$((pair.second)$)";
}
std::cout << '\n';
}
main: () = {
cont: std::unordered_multimap<int, char> = (
std::make_pair(1, 'a'),
std::make_pair(2, 'b'),
std::make_pair(3, 'c'),
);
print_map("Start:", cont);
// Extract node handle and change key
nh:= cont.extract(1);
nh.key() = 4;
print_map("After extract and before insert:", cont);
// Insert node handle back
cont.insert(move nh);
print_map("End:", cont);
}
Possible output
Start: 3(c) 2(b) 1(a)
After extract and before insert: 3(c) 2(b)
End: 4(a) 3(c) 2(b)