GF2::Vector — State Queries

Checks whether all, any, or none of the elements in a bit-bit-vector 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-vector are set to 1, otherwise false.
2 Returns true if any of the elements in the bit-vector are set to 1, otherwise false.
3 Returns true if none of the elements in the bit-vector are set to 1, otherwise false.
Calling these methods for an empty bit-vector 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::Vector<> v1("0000");
    GF2::Vector<> v2("0101");
    GF2::Vector<> v3("1111");

    std::cout
        << "Vector\t" << "all\t" << "any\t" << "none\n"
        << v1 << '\t' << v1.all() << '\t' << v1.any() << '\t' << v1.none() << '\n'
        << v2 << '\t' << v2.all() << '\t' << v2.any() << '\t' << v2.none() << '\n'
        << v3 << '\t' << v3.all() << '\t' << v3.any() << '\t' << v3.none() << '\n';
}
Output
Vector  all     any     none
0000    0       0       1
0101    0       1       0
1111    1       1       0
See Also

count