Skip to content

Commit 606d23d

Browse files
authored
Update 010_map_try_emplace.cpp
1 parent ef90e28 commit 606d23d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

cpp_17/010_map_try_emplace.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
1
1+
#include <iostream>
2+
#include <utility>
3+
#include <string>
4+
5+
#include <map>
6+
int main()
7+
{
8+
using namespace std::literals;
9+
std::map<std::string, std::string> m;
10+
11+
m.try_emplace("a", "a"s);
12+
m.try_emplace("b", "abcd");
13+
m.try_emplace("c", 10, 'c');
14+
15+
for (const auto &p : m) {
16+
std::cout << p.first << " => " << p.second << '\n';
17+
}
18+
}

0 commit comments

Comments
 (0)