flags
flags.hSince:
TBCProvides a wrapper around a set of binary flags.
Supports compile time and runtime variants
template <typename T, T MASK = etl::integral_limits<T>::max>
class flagsT must be an unsigned integral type.
MASK is used to exclude unused or undefined bits from operations of the flags. By default, all bits are included.
Most member functions may be chained.
bool isF5Set = flags.set(bitPattern, true).flip().test(F5);Constructor
ETL_CONSTEXPR flags() ETL_NOEXCEPTDescription
Constructs a flag set with all elements set to 0 (false).
ETL_CONSTEXPR flags(value_type pattern) ETL_NOEXCEPTDescription Constructs a flag set with elements set to pattern.
ETL_CONSTEXPR flags(const flags<T, MASK>& pattern) ETL_NOEXCEPTDescription Constructs a flag set with elements set to pattern.
Modifiers
ETL_CONSTEXPR14 flags<T, MASK>& operator=(flags<T, MASK> other) ETL_NOEXCEPTDescription Assigns from another flags object.
ETL_CONSTEXPR14 flags<T, MASK>& operator=(value_type pattern) ETL_NOEXCEPTDescription Assigns from a bit pattern.
template <value_type pattern, bool value>
ETL_CONSTEXPR14 flags<T, MASK>& set() ETL_NOEXCEPTtemplate <value_type pattern>
ETL_CONSTEXPR14 flags<T, MASK>& set(bool value) ETL_NOEXCEPTtemplate <value_type pattern>
ETL_CONSTEXPR14 flags<T, MASK>& set() ETL_NOEXCEPTETL_CONSTEXPR14 flags<T, MASK>& set(value_type pattern) ETL_NOEXCEPTETL_CONSTEXPR14 flags<T, MASK>& set(value_type pattern, bool value) ETL_NOEXCEPTETL_CONSTEXPR14 flags<T, MASK>& clear() ETL_NOEXCEPTtemplate <value_type pattern> ETL_CONSTEXPR14 flags<T, MASK>& reset() ETL_NOEXCEPT
ETL_CONSTEXPR14 flags<T, MASK>& reset(value_type pattern) ETL_NOEXCEPT
ETL_CONSTEXPR14 flags<T, MASK>& flip() ETL_NOEXCEPT
template <value_type pattern> ETL_CONSTEXPR14 flags<T, MASK>& flip() ETL_NOEXCEPT
ETL_CONSTEXPR14 flags<T, MASK>& flip(value_type pattern) ETL_NOEXCEPT
Access
template <value_type pattern> ETL_CONSTEXPR bool test() const ETL_NOEXCEPT Test the bits for the compile time pattern.
ETL_CONSTEXPR bool test(value_type pattern) const ETL_NOEXCEPT Test the bits for the run time pattern.
ETL_CONSTEXPR value_type value() const ETL_NOEXCEPT ETL_CONSTEXPR operator value_type() const ETL_NOEXCEPT Returns the value of the flags as a value_type.
Operations
Non-member functions
template <typename T, T MASK> void swap(flags<T, MASK>& lhs, flags<T, MASK>& rhs) Swaps two flags.
template <typename T, T MASK> bool operator == (flags<T, MASK>& lhs, flags<T, MASK>& rhs) Checks equality of two flags.
template <typename T, T MASK> bool operator != (flags<T, MASK>& lhs, flags<T, MASK>& rhs) Checks inequality of two flags.