GF2::Vector — Swap Elements

Method to swap the values of two individual elements/bits in a bit-vector.

constexpr Vector &swap(std::size_t i, std::size_t j) const;       (1)
1 Swaps the values at element i and element j.
By default, the method does not check whether the indices are in bounds and if they aren’t the behavior is undefined (but bound to be bad!) Range checking is performed if the GF2_DEBUG flag is set at compile time. See the discussion of the gf2_debug_assert macro.
Example
#include <GF2/GF2.h>
int main()
{
    GF2::Vector<> v(2);
    v(0) = 0; v(1) = 1;
    std::cout << "Before swap v = " << v << "\n";
    v.swap_elements(0,1);
    std::cout << "After  swap v = " << v << "\n";
}
Output
Before swap v = 01
After  swap v = 10