![]() |
Gaia-ECS v1.0.0
A simple and powerful entity component system
|
Fixed-size bit set. More...
#include <bitset.h>
Public Types | |
| using | size_type = typename size_type_selector< BitsPerItem==32 >::type |
| Unsigned backing-word type. | |
| using | iter = const_iterator< bitset > |
| Forward iterator over set bit indices. | |
| using | iter_inv = const_iterator_inverse< bitset > |
| Forward iterator over unset bit indices. | |
| using | iter_rev = const_reverse_iterator< bitset > |
| Reverse iterator over set bit indices. | |
| using | iter_rev_inv = const_reverse_inverse_iterator< bitset > |
| Reverse iterator over unset bit indices. | |
Public Member Functions | |
| constexpr size_type * | data () |
| Returns the mutable backing-word storage. | |
| constexpr const size_type * | data () const |
| Returns the immutable backing-word storage. | |
| GAIA_NODISCARD constexpr uint32_t | items () const |
| Returns the number of words used by the bitset internally. | |
| constexpr iter | begin () const |
| Returns an iterator to the first set bit. | |
| constexpr iter | end () const |
| Returns the forward set-bit sentinel. | |
| constexpr iter_rev | rbegin () const |
| Returns an iterator to the last set bit. | |
| constexpr iter_rev | rend () const |
| Returns the reverse set-bit sentinel. | |
| constexpr iter_inv | ibegin () const |
| Returns an iterator to the first unset bit. | |
| constexpr iter_inv | iend () const |
| Returns the forward unset-bit sentinel. | |
| constexpr iter_rev_inv | ribegin () const |
| Returns an iterator to the last unset bit. | |
| constexpr iter_rev_inv | riend () const |
| Returns the reverse unset-bit sentinel. | |
| GAIA_NODISCARD constexpr bool | operator[] (uint32_t pos) const |
| Tests a bit. | |
| GAIA_NODISCARD constexpr bool | operator== (const bitset &other) const |
| Compares two bit sets for equality. | |
| GAIA_NODISCARD constexpr bool | operator!= (const bitset &other) const |
| Compares two bit sets for inequality. | |
| constexpr void | set () |
| Sets all bits. | |
| constexpr void | set (uint32_t pos, bool value=true) |
| Sets the bit at the given position. | |
| constexpr bitset & | flip () |
| Flips all bits. | |
| constexpr void | flip (uint32_t pos) |
| Flips one bit. | |
| constexpr bitset & | flip (uint32_t bitFrom, uint32_t bitTo) |
| Flips an inclusive range of bits. | |
| constexpr void | reset () |
| Unsets all bits. | |
| constexpr void | reset (uint32_t pos) |
| Unsets one bit. | |
| GAIA_NODISCARD constexpr bool | test (uint32_t pos) const |
| Returns the value of one bit. | |
| GAIA_NODISCARD constexpr bool | all () const |
| Checks if all bits are set. | |
| GAIA_NODISCARD constexpr bool | any () const |
| Checks if any bit is set. | |
| GAIA_NODISCARD constexpr bool | none () const |
| Checks if all bits are reset. | |
| GAIA_NODISCARD uint32_t | count () const |
| Returns the number of set bits. | |
| GAIA_NODISCARD constexpr uint32_t | size () const |
| Returns the number of bits the bitset can hold. | |
Static Public Attributes | |
| static constexpr uint32_t | BitCount = NBits |
| Number of addressable bits. | |
| static constexpr uint32_t | BitsPerItem = (NBits / 64) > 0 ? 64 : 32 |
| Number of bits stored in each backing word. | |
| static constexpr uint32_t | Items = (NBits + BitsPerItem - 1) / BitsPerItem |
| Number of backing words. | |
Fixed-size bit set.
| NBits | Number of addressable bits. |
|
inlineconstexpr |
Checks if all bits are set.
|
inlineconstexpr |
Checks if any bit is set.
|
inlineconstexpr |
Returns an iterator to the first set bit.
|
inline |
Returns the number of set bits.
|
inlineconstexpr |
Returns the mutable backing-word storage.
|
inlineconstexpr |
Returns the immutable backing-word storage.
|
inlineconstexpr |
Returns the forward set-bit sentinel.
|
inlineconstexpr |
Flips all bits.
|
inlineconstexpr |
Flips an inclusive range of bits.
| bitFrom | First bit position to flip. |
| bitTo | Last bit position to flip, inclusive. |
|
inlineconstexpr |
Flips one bit.
| pos | Zero-based bit position, which must be less than NBits. |
|
inlineconstexpr |
Returns an iterator to the first unset bit.
|
inlineconstexpr |
Returns the forward unset-bit sentinel.
|
inlineconstexpr |
Returns the number of words used by the bitset internally.
|
inlineconstexpr |
Checks if all bits are reset.
|
inlineconstexpr |
Compares two bit sets for inequality.
| other | Bit set to compare with. |
|
inlineconstexpr |
Compares two bit sets for equality.
| other | Bit set to compare with. |
|
inlineconstexpr |
Tests a bit.
| pos | Zero-based bit position, which must be less than NBits. |
|
inlineconstexpr |
Returns an iterator to the last set bit.
|
inlineconstexpr |
Returns the reverse set-bit sentinel.
|
inlineconstexpr |
Unsets one bit.
| pos | Zero-based bit position, which must be less than NBits. |
|
inlineconstexpr |
Returns an iterator to the last unset bit.
|
inlineconstexpr |
Returns the reverse unset-bit sentinel.
|
inlineconstexpr |
Sets the bit at the given position.
| pos | Bit position to set (0-based, must be < NBits) |
| value | Value to set the bit to. Defaults to true. |
|
inlineconstexpr |
Returns the number of bits the bitset can hold.
|
inlineconstexpr |
Returns the value of one bit.
| pos | Zero-based bit position, which must be less than NBits. |