| 42 | 
  | 
#include "utils/BitSet.hpp" | 
| 43 | 
  | 
#include <algorithm> | 
| 44 | 
  | 
#include <cassert> | 
| 45 | 
< | 
 | 
| 45 | 
> | 
#include <string> | 
| 46 | 
  | 
namespace oopse { | 
| 47 | 
  | 
int BitSet::countBits() { | 
| 48 | 
  | 
    return std::count(bitset_.begin(), bitset_.end(), true); | 
| 76 | 
  | 
    return i == bitset_.end() ? true : false; | 
| 77 | 
  | 
} | 
| 78 | 
  | 
     | 
| 79 | 
< | 
int BitSet::nextOffBit(int fromIndex) { | 
| 79 | 
> | 
int BitSet::nextOffBit(int fromIndex) const { | 
| 80 | 
  | 
    ++fromIndex; | 
| 81 | 
  | 
    while (fromIndex < size()) { | 
| 82 | 
  | 
        if (!bitset_[fromIndex]) { | 
| 88 | 
  | 
    return -1; | 
| 89 | 
  | 
} | 
| 90 | 
  | 
 | 
| 91 | 
< | 
int BitSet::nextOnBit(int fromIndex) { | 
| 91 | 
> | 
int BitSet::nextOnBit(int fromIndex) const { | 
| 92 | 
  | 
    ++fromIndex; | 
| 93 | 
  | 
    while (fromIndex < size()) { | 
| 94 | 
  | 
        if (bitset_[fromIndex]) { | 
| 168 | 
  | 
} | 
| 169 | 
  | 
 | 
| 170 | 
  | 
std::ostream& operator<< ( std::ostream& os, const BitSet& bs) { | 
| 171 | 
+ | 
    for (int i = 0; i < bs.bitset_.size(); ++i) { | 
| 172 | 
+ | 
        std::string val = bs[i] ? "true" : "false"; | 
| 173 | 
+ | 
        os << "BitSet[" << i <<"] = " << val << std::endl;  | 
| 174 | 
+ | 
    } | 
| 175 | 
+ | 
     | 
| 176 | 
  | 
    return os; | 
| 177 | 
  | 
} | 
| 178 | 
  | 
 |