mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Allow iterating a BaseBitSet.
parent
0af5d5a9e6
commit
ca3b5ed6c1
|
@ -13,6 +13,8 @@
|
||||||
#ifndef BASE_BITSET_TYPE_HPP
|
#ifndef BASE_BITSET_TYPE_HPP
|
||||||
#define BASE_BITSET_TYPE_HPP
|
#define BASE_BITSET_TYPE_HPP
|
||||||
|
|
||||||
|
#include "bitmath_func.hpp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base for bit set wrapper.
|
* Base for bit set wrapper.
|
||||||
* Allows wrapping strong type values as a bit set. Methods are loosely modelled on std::bitset.
|
* Allows wrapping strong type values as a bit set. Methods are loosely modelled on std::bitset.
|
||||||
|
@ -206,6 +208,9 @@ public:
|
||||||
return (this->base() & Tmask) == this->base();
|
return (this->base() & Tmask) == this->base();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto begin() const { return SetBitIterator<Tvalue_type>(this->data).begin(); }
|
||||||
|
auto end() const { return SetBitIterator<Tvalue_type>(this->data).end(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tstorage data; ///< Bitmask of values.
|
Tstorage data; ///< Bitmask of values.
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue