226 return other.bits != 0 && (
bits & other.bits) == other.bits;
360 char buf[2 +
sizeof(underlying) * 2];
364 return std::string(
buf, ptr);
369#include "sdkconfig.h"
370#ifdef CONFIG_IDFXX_STD_FORMAT
375template<
idfxx::flag_enum E>
377 constexpr auto parse(format_parse_context& ctx) {
return ctx.begin(); }
379 template<
typename FormatContext>
382 return std::copy(s.begin(), s.end(), ctx.out());
Type-safe set of flags from a scoped enum.
constexpr flags operator|(flags other) const noexcept
Combines flags using bitwise OR.
constexpr bool operator==(flags const &) const noexcept=default
Equality comparison between flags objects.
std::underlying_type_t< E > underlying
The underlying integral type of the enum.
constexpr bool contains_any(flags other) const noexcept
Checks if any of the specified flags are set.
constexpr flags operator-(flags other) const noexcept
Clears specific flags (set difference).
constexpr bool contains(flags other) const noexcept
Checks if all specified flags are set.
constexpr flags() noexcept=default
Default constructor, initializes to empty flags (zero).
constexpr bool empty() const noexcept
Checks if no flags are set.
constexpr flags operator&(flags other) const noexcept
Intersects flags using bitwise AND.
constexpr bool operator==(E e) const noexcept
Equality comparison with an individual enum value.
constexpr flags operator^(flags other) const noexcept
Toggles flags using bitwise XOR.
constexpr flags & operator|=(flags other) noexcept
Combines flags in-place using bitwise OR.
constexpr flags & operator&=(flags other) noexcept
Intersects flags in-place using bitwise AND.
E enum_type
The scoped enum type.
constexpr flags operator~() const noexcept
Computes the bitwise complement.
constexpr flags & operator^=(flags other) noexcept
Toggles flags in-place using bitwise XOR.
constexpr flags & operator-=(flags other) noexcept
Clears specific flags in-place (set difference).
Concept for enums that have opted into flag operators.
std::string to_string(core_id c)
Returns a string representation of a CPU core identifier.
constexpr flags< E > operator~(E a) noexcept
Computes the bitwise complement of an enum value.
constexpr bool enable_flags_operators
Opt-in trait for enabling flag operators on an enum.
constexpr flags< E > operator^(E a, E b) noexcept
Toggles two enum values into a flags object.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
flags(E) -> flags< E >
Class template argument deduction guide.
constexpr auto to_underlying(flags< E > f) noexcept
Returns the underlying integral value of a flags object.
constexpr flags< E > operator|(E a, E b) noexcept
Combines two enum values into a flags object.
constexpr flags< E > operator&(E a, E b) noexcept
Intersects two enum values into a flags object.