GF2::Vector — Logical Difference of Two Bit-vectors

Returns a bit-vector that is the logical DIFF of two equal sized bit-vectors.

template<std::unsigned_integral Block, typename Allocator>
constexpr bool
diff(const Vector<Block, Allocator> &u,
     const Vector<Block, Allocator> &v); (1)
1 Returns a bit-vector w where w[i] = 1 if u[i] != v[i] and 0 otherwise.
The two vectors in question must be of the same size. If the GF2_DEBUG flag is set at compile time this is checked and any violation will cause the program to abort with a helpful message.
Example
#include <GF2/GF2.h>
int main()
{
    GF2::Vector<> u("111111");
    GF2::Vector<> v("101010");
    std::cout << "diff(" << u << ", " << v << ") yields " << GF2::diff(u, v) << '\n';
}
Output
diff(111111, 101010) yields 010101
See Also

append