number of ones in a bitset in a range code example Example: the number of ones int bitset bitset<10> s(string("0010011010")); cout << s.count() << "\n"; // 4