std::flat_map::at(3)
π std::flat_map::at(3) β C++ Standard Libary π
okay bestie, this is the group-chat translation of the std::flat_map::at page, and yes we are keeping every single detail because facts are the main character π
πΈ NAME πΈ
std::flat_map::at β std::flat_map::at
π¦ Synopsis π¦
T& at( const Key& key ); (1) (since C++23)
const T& at( const Key& key ) const; (2) (since C++23)
template< class K > (3) (since C++23)
T& at( const K& x );
template< class K > (4) (since C++23)
const T& at( const K& x ) const;
okay so this function returns a reference to the mapped value of the element with specified key β¨. If no such element exists, an exception of type std::out_of_range is thrown π.
1,2)β The key is equivalent tokey.3,4)β The key compares equivalent to the valuex. The reference to the mapped value is obtained as if by expressionthis->find(x)->second.- The expression
this->find(x)must be well-formed and have well-defined behavior, otherwise the behavior is undefined π¨. Like, do not play with undefined behavior, bestie. - These overloads participate in overload resolution only if the qualified-id
Compare::is_transparentis valid and denotes a type. It allows calling this function without constructing an instance ofKey.
π Parameters π
keyβ the key of the element to findxβ a value of any type that can be transparently compared with a key
π Return value π
A reference to the mapped value of the requested element. Itβs giving βhere is your referenceβ energy π«Ά.
π Exceptions π
1,2)βstd::out_of_rangeif the container does not have an element with the specifiedkey.3,4)βstd::out_of_rangeif the container does not have the specified element, that is, iffind(x) == end()is true.
π₯ Complexity π₯
Logarithmic in the size of the container. No cap, thatβs the complexity π§.
π§ Example π§
This section is incomplete.
Reason: no example.
π See also π
operator[]β access or insert specified element (public member function)
π Category π
- Todo no example
Source/version/date sign-off: http://cppreference.com, 2024.06.10, std::flat_map::at(3) β mwah, bestie πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms