43 |
|
#define UTILS_BITSET_HPP |
44 |
|
|
45 |
|
#include <iostream> |
46 |
– |
#include <functional> |
46 |
|
#include <vector> |
47 |
|
namespace oopse { |
48 |
|
|
80 |
|
|
81 |
|
/** Returns true if no bits are set to true */ |
82 |
|
bool none(); |
83 |
+ |
|
84 |
+ |
int firstOffBit() { return !bitset_[0] ? 0 : nextOffBit(0); } |
85 |
|
|
86 |
|
/** Returns the index of the first bit that is set to false that occurs on or after the specified starting index.*/ |
87 |
|
int nextOffBit(int fromIndex) const; |
88 |
< |
|
88 |
> |
|
89 |
> |
int firstOnBit() { return bitset_[0] ? 0 : nextOnBit(0); } |
90 |
> |
|
91 |
|
/** Returns the index of the first bit that is set to true that occurs on or after the specified starting index. */ |
92 |
|
int nextOnBit(int fromIndex) const; |
93 |
|
|
142 |
|
std::vector<char> bitset_; |
143 |
|
}; |
144 |
|
|
142 |
– |
template<typename T> |
143 |
– |
struct logical_xor :public std::binary_function<T, T, bool> { |
144 |
– |
double operator()(T x, T y) { return x ^ y; } |
145 |
– |
}; |
145 |
|
|
146 |
|
} |
147 |
|
#endif |