Use boolean_vector in boolean_matrix
[libstick.git] / include / libstick-0.1 / booleanvector.h
index 5bfd7e3391c49d44db5a5a4dda763062d3811d95..d7eb41bc9d7bc43109b964d20c67547f17dafa89 100644 (file)
@@ -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<IT> &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<IT> &vec) const {
             return get_ones() == vec.get_ones();