bitset::count

size_t count() const;

The member function returns the number of bits set in the bit sequence.