Namespaces
Variants

std::flat_set<Key,Compare,KeyContainer>::swap

From cppreference.com

[edit template]
 
 
 
 
void swap( flat_set& 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, other.c);
.

Parameters

other - container adaptor to exchange the contents with

Exceptions

noexcept specification:  
noexcept(std::is_nothrow_swappable_v<container_type> &&
         std::is_nothrow_swappable_v<key_compare>)

Complexity

Same as underlying container (typically constant).

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

overloads the std::swap algorithm
(function template) [edit]