23#ifndef VCL_SPACE_CORE_BIT_SET_BIT_PROXY_H
24#define VCL_SPACE_CORE_BIT_SET_BIT_PROXY_H
26#include <vclib/base.h>
41template<std::
integral T>
44 std::reference_wrapper<T> mMask;
58 BitProxy(T& mask, uint index) : mMask(mask), mIndex(index) {}
60 operator bool()
const {
return mMask.get() & (1 << mIndex); }
62 void operator=(
bool bit)
64 mMask.get() = (mMask.get() & ~(1 << mIndex)) | (bit << mIndex);
69 mMask.get() |= (bit << mIndex);
75 mMask.get() &= ~(bit << mIndex);
81 mMask.get() ^= (bit << mIndex);
100 std::remove_cvref_t<T>,
101 BitProxy<typename RemoveRef<T>::UnderlyingType>>;
The BitProxy class allows to access to a bool reference from a bit saved in a mask,...
Definition bit_proxy.h:43
BitProxy(T &mask, uint index)
Constructs the BitProxy with the given mask and index.
Definition bit_proxy.h:58
T UnderlyingType
The type of the underlying integral value used to store the bits.
Definition bit_proxy.h:51
A class representing a box in N-dimensional space.
Definition box.h:46
A concept representing a BitProxy.
Definition bit_proxy.h:99