MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / map_with_integer_key_example

Function map_with_integer_key_example

examples/src/container_examples.cpp:83–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void map_with_integer_key_example()
84{
85 std::map<short, std::string> m{ {1,"foo",},{2,"baz"} };
86
87 json j{m};
88
89 std::cout << "(1)\n";
90 std::cout << pretty_print(j) << "\n\n";
91
92 auto other = j.as<std::map<uint64_t, std::string>>();
93
94 std::cout << "(2)\n";
95 for (const auto& item : other)
96 {
97 std::cout << item.first << " | " << item.second << "\n";
98 }
99 std::cout << "\n\n";
100}
101
102int main()
103{

Callers 1

mainFunction · 0.85

Calls 1

pretty_printFunction · 0.85

Tested by

no test coverage detected