GF2::Matrix — Check on Set Bits

Checks whether all, any, or none of the elements in a bit-matrix are set (i.e. 1).

constexpr bool all() const;     (1)
constexpr bool any() const;     (2)
constexpr bool none() const;    (3)
1 Returns true if all the elements in the bit-matrix are set to 1, otherwise false.
2 Returns true if any of the elements in the bit-matrix are set to 1, otherwise false.
3 Returns true if none of the elements in the bit-matrix are set to 1, otherwise false.
Calling these methods for an empty bit-matrix makes no sense and if the GF2_DEBUG flag is set will cause the program to abort with a helpful message. If the GF2_DEBUG flag is not set, all() and none() both return true while any() will return false. The inconsistency is deliberate.
Example
#include <GF2/GF2.h>
int main()
{
    GF2::Matrix<> m1("000 000 000");
    GF2::Matrix<> m2("010 101 010");
    GF2::Matrix<> m3("111 111 111");

    std::cout
        << "matrix\t" << "all\t" << "any\t" << "none\n"
        << m1 << '\t' << m1.all() << '\t' << m1.any() << '\t' << m1.none() << "\n\n"
        << m2 << '\t' << m2.all() << '\t' << m2.any() << '\t' << m2.none() << "\n\n"
        << m3 << '\t' << m3.all() << '\t' << m3.any() << '\t' << m3.none() << "\n";
}
Output
matrix  all     any     none
000
000
000     0       0       1

010
101
010     0       1       0

111
111
111     1       1       0
See Also

count