X-Git-Url: https://git.sthu.org/?p=libstick.git;a=blobdiff_plain;f=include%2Flibstick-0.1%2Fbooleanvector.h;h=d7eb41bc9d7bc43109b964d20c67547f17dafa89;hp=5bfd7e3391c49d44db5a5a4dda763062d3811d95;hb=54836e4fa90f52c9682c7918c47b28177e6f4170;hpb=c24df30e6826f1eca6444681c09723198bc675b7 diff --git a/include/libstick-0.1/booleanvector.h b/include/libstick-0.1/booleanvector.h index 5bfd7e3..d7eb41b 100644 --- a/include/libstick-0.1/booleanvector.h +++ b/include/libstick-0.1/booleanvector.h @@ -47,6 +47,11 @@ class sorted_boolean_vector { return array; } + /** Count the number of 1s. */ + size_t size() const { + return get_ones().size(); + } + /** Two vectors are equal if they contain the same indices. */ bool operator==(const sorted_boolean_vector &vec) const { return get_ones() == vec.get_ones(); @@ -173,6 +178,11 @@ class heapsorted_boolean_vector { return array; } + /** Count the number of 1s. */ + size_t size() const { + return get_ones().size(); + } + /** Two vectors are equal if they contain the same indices. */ bool operator==(const heapsorted_boolean_vector &vec) const { return get_ones() == vec.get_ones();