69template<
typename TEnum>
70requires std::is_enum<TEnum>::value
78template<
typename TEnum>
116template<
typename TEnum>
118constexpr TEnum
operator& (TEnum lhs, TEnum rhs)
noexcept {
119 using TBits=
typename std::underlying_type<TEnum>::type;
120 return TEnum(TBits(lhs) & TBits(rhs));
132template<
typename TEnum>
135 using TBits=
typename std::underlying_type<TEnum>::type;
136 return lhs= TEnum( TBits(lhs) & TBits(rhs) );
148template<
typename TEnum>
150constexpr TEnum
operator| (TEnum lhs, TEnum rhs)
noexcept {
151 using TBits=
typename std::underlying_type<TEnum>::type;
152 return TEnum(TBits(lhs) | TBits(rhs));
164template<
typename TEnum>
167 using TBits=
typename std::underlying_type<TEnum>::type;
168 return lhs= TEnum( TBits(lhs) | TBits(rhs) );
180template<
typename TEnum>
182constexpr TEnum
operator^ (TEnum lhs, TEnum rhs)
noexcept {
183 using TBits=
typename std::underlying_type<TEnum>::type;
184 return TEnum(TBits(lhs) ^ TBits(rhs));
196template<
typename TEnum>
199 using TBits=
typename std::underlying_type<TEnum>::type;
200 return lhs= TEnum( TBits(lhs) ^ TBits(rhs) );
215template<
typename TEnum>
218 using TBits=
typename std::underlying_type<TEnum>::type;
219 return TEnum( ~ TBits(op) );
234template<
typename TEnum>
235requires ( alib::enumops::IsBitwise <TEnum>
237constexpr TEnum
operator+ (TEnum lhs, TEnum rhs)
noexcept {
238 using TBits=
typename std::underlying_type<TEnum>::type;
239 return TEnum(TBits(lhs) | TBits(rhs));
253template<
typename TEnum>
254requires ( alib::enumops::IsBitwise <TEnum>
256constexpr TEnum
operator+= (TEnum& lhs, TEnum rhs)
noexcept {
257 using TBits=
typename std::underlying_type<TEnum>::type;
258 return lhs= TEnum( TBits(lhs) | TBits(rhs) );
275template<
typename TEnum>
276requires ( alib::enumops::IsBitwise <TEnum>
278constexpr TEnum
operator- (TEnum lhs, TEnum rhs)
noexcept {
279 using TBits=
typename std::underlying_type<TEnum>::type;
280 return TEnum( TBits(lhs) & (~TBits(rhs)) );
297template<
typename TEnum>
298requires ( alib::enumops::IsBitwise <TEnum>
300constexpr TEnum
operator-= (TEnum& lhs, TEnum rhs)
noexcept {
301 using TBits=
typename std::underlying_type<TEnum>::type;
302 return lhs= TEnum( TBits(lhs) & (~TBits(rhs)) );
322template<
typename TEnum>
324constexpr bool HasBits(TEnum element, TEnum selection)
noexcept {
325 using TBits=
typename std::underlying_type<TEnum>::type;
326 return ( TBits(element) & TBits(selection) ) == TBits(selection);
342template<
typename TEnum>
344constexpr bool HasOneOf(TEnum element, TEnum selection)
noexcept {
345 using TBits=
typename std::underlying_type<TEnum>::type;
346 return ( TBits(element) & TBits(selection) ) != TBits(0);
357template<
typename TEnum>
#define ALIB_POP_ALLOWANCE
ALIB_EXPORT constexpr TEnum operator|=(TEnum &lhs, TEnum rhs) noexcept
ALIB_EXPORT constexpr TEnum operator~(TEnum op) noexcept
ALIB_EXPORT constexpr TEnum operator&=(TEnum &lhs, TEnum rhs) noexcept
ALIB_EXPORT constexpr TEnum operator|(TEnum lhs, TEnum rhs) noexcept
constexpr bool HasOneOf(TEnum element, TEnum selection) noexcept
ALIB_EXPORT constexpr TEnum operator^=(TEnum &lhs, TEnum rhs) noexcept
ALIB_EXPORT constexpr TEnum operator^(TEnum lhs, TEnum rhs) noexcept
constexpr int CountElements(TEnum value)
ALIB_EXPORT constexpr TEnum operator&(TEnum lhs, TEnum rhs) noexcept
constexpr bool HasBits(TEnum element, TEnum selection) noexcept
std::underlying_type_t< TEnum > constexpr UnderlyingIntegral(TEnum element) noexcept
constexpr int BitCount(TIntegral value)