# | Line 42 | Line 42 | |
---|---|---|
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); | |
# | Line 76 | Line 76 | bool BitSet::none() { | |
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]) { | |
# | Line 88 | Line 88 | int BitSet::nextOffBit(int 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]) { | |
# | Line 168 | Line 168 | std::ostream& operator<< ( std::ostream& os, const Bit | |
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 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |