header_utils
Loading...
Searching...
No Matches
ghassanpl::enum_flags< ENUM, VALUE_TYPE > Struct Template Reference

A (constexpr) value struct that represents a set of bits mapped to an enum (implemented as a bitset). More...

#include <enum_flags.h>

Public Types

using value_type
 The underlying integral value type that holds the bits representing the flags.
using enum_type
 Type of the enum that is the source of the flags.
using self_type
using flag_changes

Public Member Functions

constexpr enum_flags (const enum_flags &) noexcept=default
constexpr enum_flags (enum_flags &&) noexcept=default
constexpr enum_flags & operator= (const enum_flags &) noexcept=default
constexpr enum_flags & operator= (enum_flags &&) noexcept=default
constexpr enum_flags (enum_type base_value) noexcept
template<typename U = VALUE_TYPE>
constexpr enum_flags (value_type value) noexcept
template<typename... ARGS>
constexpr enum_flags (enum_type base_value, ARGS... args) noexcept
 Constructs the value with all the given flags set.
constexpr enum_flags (std::initializer_list< enum_type > values) noexcept
constexpr enum_flags (all_flags_t) noexcept
constexpr enum_flags (no_flags_t) noexcept
constexpr bool is_set (enum_type flag) const noexcept
 Returns whether or not flag is set.
constexpr bool contain (enum_type flag) const noexcept
 Same as is_set.
constexpr bool contains (enum_type flag) const noexcept
 Same as is_set.
template<std::convertible_to< enum_type >... FLAGS>
constexpr auto get (enum_type flag1, enum_type flag2, FLAGS... rest)
 Returns an array of bools that are set to the value of contains(param) for each flag parameter Useful for destructuring.
constexpr int count () const noexcept
 Returns the number of flags set.
constexpr enum_type nth_set (size_t n) const noexcept
 Returns the value of the nth set bit in the set Preconditions: n must be less than the number of bits set (n < count()).
constexpr enum_type first_set () const noexcept
 Returns the lowest numerical value in the set. Returns an unspecified value if no values are in the set.
constexpr enum_type last_set () const noexcept
 Returns the highest numerical value in the set, or enum_type(-1) if no values are in the set.
template<typename... ARGS>
constexpr bool contains_any_of (enum_type arg, ARGS... args) const noexcept
 Returns whether or not any of the given flags are set.
template<typename... ARGS>
constexpr bool contains_none_of (enum_type arg, ARGS... args) const noexcept
 Returns whether or not any of the given flags are set.
constexpr bool are_any_set () const noexcept
 Returns whether or not any of the given flags are set.
constexpr bool full () const noexcept
 Returns whether *this == all().
constexpr bool contains_any_of (self_type other) const noexcept
 Returns whether or not any of the flags in the other set are set.
template<typename... ARGS>
constexpr bool contains_all_of (ARGS... args) const noexcept
 Returns whether or not all of the given flags are set.
constexpr bool contains_all_of (self_type other) const noexcept
 Returns whether or not all of the flags in the other set are set.
constexpr operator bool () const noexcept
constexpr enum_type to_enum_type () const noexcept
 Returns the underlying value representing this set cast to the enum_type.
template<std::convertible_to< enum_type >... ARGS>
constexpr self_type & set (ARGS... args) noexcept
 Sets the given flags.
constexpr self_type & set (self_type other) noexcept
 Sets the flags in the other.
template<std::convertible_to< enum_type >... ARGS>
constexpr self_type & unset (ARGS... args) noexcept
 Unsets the given flags.
constexpr self_type & unset (self_type other) noexcept
 Unsets the flags in the other set.
template<std::convertible_to< enum_type >... ARGS>
constexpr self_type & toggle (ARGS... args) noexcept
 Toggles the given flags.
constexpr self_type & toggle (self_type other) noexcept
 Toggles the flags in the other set.
template<std::convertible_to< enum_type >... ARGS>
constexpr self_type & set_to (bool val, ARGS... args) noexcept
 Sets the given flags to val.
constexpr self_type & set_to (bool val, self_type other) noexcept
 Sets the flags in the other set to val.
constexpr self_type but_only (self_type flags) const noexcept
 Returns a value with our bits from only the flags that are also set in flags (an intersection).
constexpr self_type intersected_with (self_type flags) const noexcept
 Returns a value with our bits from only the flags that are also set in flags (an intersection).
constexpr self_type operator+ (enum_type flag) const noexcept
constexpr self_type operator- (enum_type flag) const noexcept
constexpr self_type operator+ (self_type flags) const noexcept
constexpr self_type operator- (self_type flags) const noexcept
constexpr self_type operator- () const noexcept
constexpr self_type except_for (self_type flags) const noexcept
constexpr self_type without (self_type flags) const noexcept
template<std::convertible_to< enum_type >... ARGS>
constexpr self_type except_for (ARGS... args) const noexcept
template<std::convertible_to< enum_type >... ARGS>
constexpr self_type without (ARGS... args) const noexcept
constexpr self_type & operator+= (enum_type flag) noexcept
constexpr self_type & operator-= (enum_type flag) noexcept
constexpr self_type & operator+= (self_type flags) noexcept
constexpr self_type & operator-= (self_type flags) noexcept
constexpr auto operator<=> (enum_flags const &other) const noexcept=default
iterator begin () const noexcept
iterator end () const noexcept
iterator cbegin () const noexcept
iterator cend () const noexcept
constexpr bool empty () const noexcept
constexpr void clear () noexcept
template<typename FUNC>
constexpr auto for_each (FUNC &&callback) const
 Calls callback for each enum flag in the set.
constexpr void apply (flag_changes changes) noexcept
constexpr self_type operator+ (flag_changes changes) const noexcept

Static Public Member Functions

template<integral_or_enum BITS_TYPE>
static constexpr self_type from_bits (BITS_TYPE val) noexcept
 Creates the enum_flags set from the given underlying bits.
static constexpr self_type all () noexcept
 Returns a value with all bits set (including the ones not in the enum, if any).
static constexpr self_type all (enum_type last) noexcept
 Returns a value with all bits set, up to and including the last.
static constexpr self_type all_between (enum_type first, enum_type last) noexcept
 Returns a value with bits starting with first, up to and including last, set.
static constexpr self_type none () noexcept
 Returns a value with none of the bits set.

Public Attributes

value_type bits

Detailed Description

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
struct ghassanpl::enum_flags< ENUM, VALUE_TYPE >

A (constexpr) value struct that represents a set of bits mapped to an enum (implemented as a bitset).

Example
enum class door_flags { closed, locked, blue };
flags.set(door_flags::closed, door_flags::blue);
if (flags.is_set(door_flags::locked)) { ... }
if (flags.contains_all_of(door_flags::closed, door_flags::locked)) { print("Not getting in"); }
flags.toggle(door_flags::locked);
for (auto flag : flags)
print("{} is set", flag);
A (constexpr) value struct that represents a set of bits mapped to an enum (implemented as a bitset).
Definition enum_flags.h:60
constexpr self_type & toggle(ARGS... args) noexcept
Toggles the given flags.
Definition enum_flags.h:222
constexpr self_type & set(ARGS... args) noexcept
Sets the given flags.
Definition enum_flags.h:210
constexpr bool contains_all_of(ARGS... args) const noexcept
Returns whether or not all of the given flags are set.
Definition enum_flags.h:193
constexpr bool is_set(enum_type flag) const noexcept
Returns whether or not flag is set.
Definition enum_flags.h:123
  • Supports +/-/+=/-=/==/!= (decided not to support &/|/^/~ to not confuse the model and implementation).
  • Is as constexpr as I could make it
  • You can specify the base integral value to store bits in (uint64_t by default)
  • Uses concepts to ensure most functions do not overflow or produce garbage results (e.g. enum values of -5 or 100 won't work with uint64_t)
  • The first template parameter doesn't have to be an enum, any integral value will work
  • It is also a range
Attention
The members of this class will only work correctly if the enum values you give are greater than 0 and lesser than the bit-width of the VALUE_TYPE
Template Parameters
ENUMthe type containing the value flags the set will hold
VALUE_TYPEthe underlying integral value that stores the bits representing the flags

Definition at line 59 of file enum_flags.h.

Member Typedef Documentation

◆ enum_type

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
using ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_type

Type of the enum that is the source of the flags.

Definition at line 65 of file enum_flags.h.

◆ flag_changes

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
using ghassanpl::enum_flags< ENUM, VALUE_TYPE >::flag_changes

Definition at line 348 of file enum_flags.h.

◆ self_type

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
using ghassanpl::enum_flags< ENUM, VALUE_TYPE >::self_type

Definition at line 66 of file enum_flags.h.

◆ value_type

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
using ghassanpl::enum_flags< ENUM, VALUE_TYPE >::value_type

The underlying integral value type that holds the bits representing the flags.

Definition at line 62 of file enum_flags.h.

Constructor & Destructor Documentation

◆ enum_flags() [1/6]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_flags ( enum_type base_value)
inlineconstexprnoexcept

Definition at line 76 of file enum_flags.h.

◆ enum_flags() [2/6]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<typename U = VALUE_TYPE>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_flags ( value_type value)
inlineexplicitconstexprnoexcept

Definition at line 79 of file enum_flags.h.

◆ enum_flags() [3/6]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<typename... ARGS>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_flags ( enum_type base_value,
ARGS... args )
inlineconstexprnoexcept

Constructs the value with all the given flags set.

Definition at line 86 of file enum_flags.h.

◆ enum_flags() [4/6]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_flags ( std::initializer_list< enum_type > values)
inlineconstexprnoexcept

Definition at line 88 of file enum_flags.h.

◆ enum_flags() [5/6]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_flags ( all_flags_t )
inlineconstexprnoexcept

Definition at line 105 of file enum_flags.h.

◆ enum_flags() [6/6]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::enum_flags ( no_flags_t )
inlineconstexprnoexcept

Definition at line 119 of file enum_flags.h.

Member Function Documentation

◆ all() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
constexpr self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::all ( )
inlinestaticnodiscardconstexprnoexcept

Returns a value with all bits set (including the ones not in the enum, if any).

Definition at line 103 of file enum_flags.h.

◆ all() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
constexpr self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::all ( enum_type last)
inlinestaticnodiscardconstexprnoexcept

Returns a value with all bits set, up to and including the last.

Definition at line 109 of file enum_flags.h.

◆ all_between()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
constexpr self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::all_between ( enum_type first,
enum_type last )
inlinestaticnodiscardconstexprnoexcept

Returns a value with bits starting with first, up to and including last, set.

Definition at line 113 of file enum_flags.h.

◆ apply()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
void ghassanpl::enum_flags< ENUM, VALUE_TYPE >::apply ( flag_changes changes)
inlineconstexprnoexcept

Definition at line 350 of file enum_flags.h.

◆ are_any_set()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::are_any_set ( ) const
inlinenodiscardconstexprnoexcept

Returns whether or not any of the given flags are set.

Definition at line 179 of file enum_flags.h.

◆ begin()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
iterator ghassanpl::enum_flags< ENUM, VALUE_TYPE >::begin ( ) const
inlinenoexcept

Definition at line 311 of file enum_flags.h.

◆ but_only()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::but_only ( self_type flags) const
inlinenodiscardconstexprnoexcept

Returns a value with our bits from only the flags that are also set in flags (an intersection).

Definition at line 243 of file enum_flags.h.

◆ cbegin()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
iterator ghassanpl::enum_flags< ENUM, VALUE_TYPE >::cbegin ( ) const
inlinenoexcept

Definition at line 313 of file enum_flags.h.

◆ cend()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
iterator ghassanpl::enum_flags< ENUM, VALUE_TYPE >::cend ( ) const
inlinenoexcept

Definition at line 314 of file enum_flags.h.

◆ clear()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
void ghassanpl::enum_flags< ENUM, VALUE_TYPE >::clear ( )
inlineconstexprnoexcept

Definition at line 317 of file enum_flags.h.

◆ contain()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contain ( enum_type flag) const
inlinenodiscardconstexprnoexcept

Same as is_set.

Definition at line 127 of file enum_flags.h.

◆ contains()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contains ( enum_type flag) const
inlinenodiscardconstexprnoexcept

Same as is_set.

Definition at line 130 of file enum_flags.h.

◆ contains_all_of() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<typename... ARGS>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contains_all_of ( ARGS... args) const
inlinenodiscardconstexprnoexcept

Returns whether or not all of the given flags are set.

Definition at line 193 of file enum_flags.h.

◆ contains_all_of() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contains_all_of ( self_type other) const
inlinenodiscardconstexprnoexcept

Returns whether or not all of the flags in the other set are set.

Definition at line 200 of file enum_flags.h.

◆ contains_any_of() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<typename... ARGS>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contains_any_of ( enum_type arg,
ARGS... args ) const
inlinenodiscardconstexprnoexcept

Returns whether or not any of the given flags are set.

Definition at line 164 of file enum_flags.h.

◆ contains_any_of() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contains_any_of ( self_type other) const
inlinenodiscardconstexprnoexcept

Returns whether or not any of the flags in the other set are set.

Note
contains_any_of({}) is true, which is correct or not, depending on whether you want it to be correct or not :P

Definition at line 188 of file enum_flags.h.

◆ contains_none_of()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<typename... ARGS>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::contains_none_of ( enum_type arg,
ARGS... args ) const
inlinenodiscardconstexprnoexcept

Returns whether or not any of the given flags are set.

Definition at line 172 of file enum_flags.h.

◆ count()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
int ghassanpl::enum_flags< ENUM, VALUE_TYPE >::count ( ) const
inlinenodiscardconstexprnoexcept

Returns the number of flags set.

Definition at line 142 of file enum_flags.h.

◆ empty()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::empty ( ) const
inlineconstexprnoexcept

Definition at line 316 of file enum_flags.h.

◆ end()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
iterator ghassanpl::enum_flags< ENUM, VALUE_TYPE >::end ( ) const
inlinenoexcept

Definition at line 312 of file enum_flags.h.

◆ except_for() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... ARGS>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::except_for ( ARGS... args) const
inlinenodiscardconstexprnoexcept

Definition at line 266 of file enum_flags.h.

◆ except_for() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::except_for ( self_type flags) const
inlinenodiscardconstexprnoexcept

Definition at line 261 of file enum_flags.h.

◆ first_set()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
enum_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::first_set ( ) const
inlinenodiscardconstexprnoexcept

Returns the lowest numerical value in the set. Returns an unspecified value if no values are in the set.

Definition at line 155 of file enum_flags.h.

◆ for_each()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<typename FUNC>
auto ghassanpl::enum_flags< ENUM, VALUE_TYPE >::for_each ( FUNC && callback) const
inlineconstexpr

Calls callback for each enum flag in the set.

Parameters
callbackThe function to call. It can return something convertible bool, and if it does, the iteration will stop when the function returns something true
Returns
void, or the value returned by the callback if it returned something true, or the value-initialized return type

TODO: See if this would be faster with a simple loop

Definition at line 326 of file enum_flags.h.

◆ from_bits()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<integral_or_enum BITS_TYPE>
constexpr self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::from_bits ( BITS_TYPE val)
inlinestaticnodiscardconstexprnoexcept

Creates the enum_flags set from the given underlying bits.

Definition at line 95 of file enum_flags.h.

◆ full()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::full ( ) const
inlinenodiscardconstexprnoexcept

Returns whether *this == all().

Definition at line 183 of file enum_flags.h.

◆ get()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... FLAGS>
auto ghassanpl::enum_flags< ENUM, VALUE_TYPE >::get ( enum_type flag1,
enum_type flag2,
FLAGS... rest )
inlineconstexpr

Returns an array of bools that are set to the value of contains(param) for each flag parameter Useful for destructuring.

Definition at line 135 of file enum_flags.h.

◆ intersected_with()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::intersected_with ( self_type flags) const
inlinenodiscardconstexprnoexcept

Returns a value with our bits from only the flags that are also set in flags (an intersection).

Definition at line 247 of file enum_flags.h.

◆ is_set()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
bool ghassanpl::enum_flags< ENUM, VALUE_TYPE >::is_set ( enum_type flag) const
inlinenodiscardconstexprnoexcept

Returns whether or not flag is set.

Definition at line 123 of file enum_flags.h.

◆ last_set()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
enum_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::last_set ( ) const
inlinenodiscardconstexprnoexcept

Returns the highest numerical value in the set, or enum_type(-1) if no values are in the set.

Definition at line 159 of file enum_flags.h.

◆ none()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
constexpr self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::none ( )
inlinestaticnodiscardconstexprnoexcept

Returns a value with none of the bits set.

Definition at line 117 of file enum_flags.h.

◆ nth_set()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
enum_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::nth_set ( size_t n) const
inlinenodiscardconstexprnoexcept

Returns the value of the nth set bit in the set Preconditions: n must be less than the number of bits set (n < count()).

Definition at line 147 of file enum_flags.h.

◆ operator bool()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Definition at line 202 of file enum_flags.h.

◆ operator+() [1/3]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator+ ( enum_type flag) const
inlinenodiscardconstexprnoexcept

Definition at line 250 of file enum_flags.h.

◆ operator+() [2/3]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator+ ( flag_changes changes) const
inlineconstexprnoexcept

Definition at line 364 of file enum_flags.h.

◆ operator+() [3/3]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator+ ( self_type flags) const
inlinenodiscardconstexprnoexcept

Definition at line 255 of file enum_flags.h.

◆ operator+=() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator+= ( enum_type flag)
inlineconstexprnoexcept

Definition at line 270 of file enum_flags.h.

◆ operator+=() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator+= ( self_type flags)
inlineconstexprnoexcept

Definition at line 273 of file enum_flags.h.

◆ operator-() [1/3]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator- ( ) const
inlinenodiscardconstexprnoexcept

Definition at line 259 of file enum_flags.h.

◆ operator-() [2/3]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator- ( enum_type flag) const
inlinenodiscardconstexprnoexcept

Definition at line 252 of file enum_flags.h.

◆ operator-() [3/3]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator- ( self_type flags) const
inlinenodiscardconstexprnoexcept

Definition at line 257 of file enum_flags.h.

◆ operator-=() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator-= ( enum_type flag)
inlineconstexprnoexcept

Definition at line 271 of file enum_flags.h.

◆ operator-=() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::operator-= ( self_type flags)
inlineconstexprnoexcept

Definition at line 274 of file enum_flags.h.

◆ set() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... ARGS>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::set ( ARGS... args)
inlineconstexprnoexcept

Sets the given flags.

Definition at line 210 of file enum_flags.h.

◆ set() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::set ( self_type other)
inlineconstexprnoexcept

Sets the flags in the other.

Definition at line 212 of file enum_flags.h.

◆ set_to() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... ARGS>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::set_to ( bool val,
ARGS... args )
inlineconstexprnoexcept

Sets the given flags to val.

Definition at line 228 of file enum_flags.h.

◆ set_to() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::set_to ( bool val,
self_type other )
inlineconstexprnoexcept

Sets the flags in the other set to val.

Definition at line 235 of file enum_flags.h.

◆ to_enum_type()

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
enum_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::to_enum_type ( ) const
inlinenodiscardconstexprnoexcept

Returns the underlying value representing this set cast to the enum_type.

Definition at line 206 of file enum_flags.h.

◆ toggle() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... ARGS>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::toggle ( ARGS... args)
inlineconstexprnoexcept

Toggles the given flags.

Definition at line 222 of file enum_flags.h.

◆ toggle() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::toggle ( self_type other)
inlineconstexprnoexcept

Toggles the flags in the other set.

Definition at line 224 of file enum_flags.h.

◆ unset() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... ARGS>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::unset ( ARGS... args)
inlineconstexprnoexcept

Unsets the given flags.

Definition at line 216 of file enum_flags.h.

◆ unset() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type & ghassanpl::enum_flags< ENUM, VALUE_TYPE >::unset ( self_type other)
inlineconstexprnoexcept

Unsets the flags in the other set.

Definition at line 218 of file enum_flags.h.

◆ without() [1/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
template<std::convertible_to< enum_type >... ARGS>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::without ( ARGS... args) const
inlinenodiscardconstexprnoexcept

Definition at line 268 of file enum_flags.h.

◆ without() [2/2]

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
self_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::without ( self_type flags) const
inlinenodiscardconstexprnoexcept

Definition at line 263 of file enum_flags.h.

Member Data Documentation

◆ bits

template<integral_or_enum ENUM, detail::valid_integral VALUE_TYPE = unsigned long long>
value_type ghassanpl::enum_flags< ENUM, VALUE_TYPE >::bits

Definition at line 68 of file enum_flags.h.