Files
cppdraft_translate/cppdraft/unord/map/elem.md
2025-10-25 03:02:53 +03:00

3.2 KiB
Raw Blame History

[unord.map.elem]

23 Containers library [containers]

23.5 Unordered associative containers [unord]

23.5.3 Class template unordered_map [unord.map]

23.5.3.3 Element access [unord.map.elem]

🔗

constexpr mapped_type& operator[](const key_type& k);

1

#

Effects: Equivalent to: return try_emplace(k).first->second;

🔗

constexpr mapped_type& operator[](key_type&& k);

2

#

Effects: Equivalent to: return try_emplace(std::move(k)).first->second;

🔗

template<class K> constexpr mapped_type& operator[](K&& k);

3

#

Constraints: The qualified-ids Hash::is_transparent andPred::is_transparent are valid and denote types.

4

#

Effects: Equivalent to: return try_emplace(std::forward(k)).first->second;

🔗

constexpr mapped_type& at(const key_type& k); constexpr const mapped_type& at(const key_type& k) const;

5

#

Returns: A reference to x.second, where x is the (unique) element whose key is equivalent to k.

6

#

Throws: An exception object of type out_of_range if no such element is present.

🔗

template<class K> constexpr mapped_type& at(const K& k); template<class K> constexpr const mapped_type& at(const K& k) const;

7

#

Constraints: The qualified-ids Hash::is_transparent andPred::is_transparent are valid and denote types.

8

#

Preconditions: The expression find(k) is well-formed and has well-defined behavior.

9

#

Returns: A reference to find(k)->second.

10

#

Throws: An exception object of type out_of_range if find(k) == end() is true.