bit::vector — Swap All Content
Swap the bits of this bit-vector with that of another.
constexpr bit::vector &swap(bit::vector &other);This method returns a reference to *this so it can be chained with other calls.
Example
#include <bit/bit.h>
int main()
{
auto u = bit::vector<>::zeros(2);
auto v = bit::vector<>::ones(4);
std::cout << "u, v: " << u << ", " << v << '\n';
u.swap(v);
std::cout << "u, v: " << u << ", " << v << '\n';
}Output
u, v: [0 0], [1 1 1 1]
u, v: [1 1 1 1], [0 0]