-
#include "tensorstore/util/small_bit_set.h"
-
template <typename T>
class tensorstore::BitRef; Mutable or constant reference to a single bit of a packed bit sequence.
BitRef
is bound to a bit location by the constructor, and cannot be rebound.- Template Parameters:¶
- Requires:¶
std::is_unsigned_v<T>
.
Types¶
- using block_type = T;
Block type used to represent the bits.
- using value_type = bool;
- using element_type = bool;
Element type of the reference.
Data members¶
- constexpr const ptrdiff_t kBitsPerBlock = sizeof(T) * 8;
Number of bits stored per
T
value.
Constructors¶
Conversion operators¶
- constexpr operator bool() const;
Returns the value of the bound bit.
Methods¶
- const BitRef& operator=(bool value) const;
Sets the bound bit to
value
, leaving all other bits unchanged.
Friend functions¶
- friend void swap(BitRef a, bool& x);
- friend void swap(bool& x, BitRef a);
Swaps the referenced bit with a
bool
value.
Related Functions¶
- void tensorstore::swap(BitRef<T> a, BitRef<U> b);
Swaps the contents of the bit to which
a
refers with the contents of the bit to whichb
refers (does not rebinda
orb
).