std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>::swap
From cppreference.com
void swap( flat_map& other ) noexcept(/* see below */);
|
(since C++23) (constexpr since C++26) |
|
Exchanges the contents of the container adaptor with those of other.
Equivalent to
ranges::swap(compare, other.compare);
ranges::swap(c.keys, other.c.keys);
ranges::swap(c.values, other.c.values);
.
Parameters
| other | - | container adaptor to exchange the contents with |
Exceptions
noexcept specification:
noexcept(std::is_nothrow_swappable_v<key_container_type> && std::is_nothrow_swappable_v<mapped_container_type> && std::is_nothrow_swappable_v<key_compare>)
Complexity
Same as underlying container (typically constant).
Example
| This section is incomplete Reason: no example |
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| P3567R2 | C++23 | the noexcept specification did not have a condition
|
added |
See also
(C++23) |
overloads the std::swap algorithm (function template) |