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

3.4 KiB
Raw Blame History

[map.access]

23 Containers library [containers]

23.4 Associative containers [associative]

23.4.3 Class template map [map]

23.4.3.3 Element access [map.access]

🔗

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

1

#

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

🔗

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

2

#

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

🔗

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

3

#

Constraints: The qualified-id Compare::is_transparent is valid and denotes a type.

4

#

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

🔗

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

5

#

Returns: A reference to the mapped_type corresponding to x in *this.

6

#

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

7

#

Complexity: Logarithmic.

🔗

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

8

#

Constraints: The qualified-id Compare::is_transparent is valid and denotes a type.

9

#

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

10

#

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

11

#

Throws: An exception object of type out_of_range iffind(x) == end() is true.

12

#

Complexity: Logarithmic.