MCPcopy Create free account
hub / github.com/0voice/cpp_new_features / main

Function main

cpp_17/010_map_merge.cpp:5–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <string>
4
5int main()
6{
7 std::map<int, std::string> ma {{1, "apple"}, {5, "pear"}, {10, "banana"}};
8 std::map<int, std::string> mb {{2, "zorro"}, {4, "batman"}, {5, "X"}, {8, "alpaca"}};
9 std::map<int, std::string> u;
10 u.merge(ma);
11 std::cout << "ma.size(): " << ma.size() << '\n';
12 u.merge(mb);
13 std::cout << "mb.size(): " << mb.size() << '\n';
14 std::cout << "mb.at(5): " << mb.at(5) << '\n';
15 for(auto const &kv: u)
16 std::cout << kv.first << ", " << kv.second << '\n';
17}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected