libstdc++: Correct swapping order for flat_set.
The order of swapping members in `flat_set::swap` has been corrected to swap the container first.
The order of swapping members in flat_set::swap has been corrected. The container (_M_cont) is now swapped before the comparator. This fixes an accidental regression introduced in r17-908, ensuring correct behavior when swapping flat_set instances. This is an internal correction with likely no direct user impact.
In Details
This commit corrects the swapping order in std::flat_set's _Flat_set_impl::swap function. Specifically, it ensures that the underlying container _M_cont is swapped before the comparator. This aligns with the intended behavior and reverses a change introduced in revision r17-908. flat_set is a C++23 container that provides set functionality using a sorted vector as its underlying storage.
For Context
The C++ Standard Template Library (STL) provides a variety of container classes, such as set, vector, and map, for storing and managing collections of data. flat_set is a relatively new container that combines the properties of a set (unique elements, sorted order) with the memory efficiency of a contiguous array (like vector). The swap function is a member function of many STL containers that exchanges the contents of two containers of the same type. Correctly implementing swap is crucial for ensuring the integrity of the container's data and maintaining its internal invariants.