Jump to content

C++: Difference between revisions

290 bytes added ,  2 July 2022
Line 565: Line 565:


====std::unordered_map====
====std::unordered_map====
<code>#include<unordered_map></code><br>
[https://en.cppreference.com/w/cpp/container/unordered_map reference]
<syntaxhighlight lang="C++">
std::unordered_map<int, std::string> my_map;
my_map.insert(5, "hey");
my_map.find(5) != my_map.end();
my_map.contains(5); // C++20
</syntaxhighlight>
;Custom Keys
;Custom Keys
How to use a rational number as a key in C++
How to use a rational number as a key in C++