Prerequisite : Unordered maps in STL
Unordered_map : unordered_map is an associated container that stores elements formed by the combination of key value and a mapped value. The key value is used to uniquely identify the element and mapped value is the content associated with the key. Both key and value can be of any type predefined or user-defined.
unordered_map :: at(): This function in C++ unordered_map returns the reference to the value with the element as key k.
unordered_map.at(k); Parameter: It is the key value of the element whose mapped value we want to access. Return type : A reference to the mapped value of the element with a key value equivalent
Note : The method gives run-time error if key is not present.
Value of key mp['second'] = 2 Exception at _Map_base::at
Practical Application : std :: unordered_map :: at() function can be used to access the mapped value and thus can edit, update etc.
Computer Application: 100 Chemistry: 98 Physics: 97 Maths: 100
How unordered_map at() is different from unordered_map operator()
- Both at() and operator is used to refer the element present at the given position, the only difference is, at() throws out-of-range exception whereas operator shows undefined behavior.
- Check if the sum of digits of N is palindrome
- Array Helper Methods in ES6
- Cyber Security in Context to Organisations
- Proof of Stake (PoS) in Blockchain
- Goldbach's Weak Conjecture for Odd numbers
- Difference between dict.items() and dict.iteritems() in Python
- Analyzing selling price of used cars using Python
- Difference between input() and raw_input() functions in Python
- Conditions for Deadlock in Operating System
- Interact with files in Python
- Minimum cells to be flipped to get a 2*2 submatrix with equal elements
- Unvalidated Redirects and Forwards
- Declare an empty List in Python
- Computer Science 101
- CSS | fit-content() Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.