Skip to content

Commit

Permalink
flags: Implemented a variant of the includes check that sees if a sui…
Browse files Browse the repository at this point in the history
…te of flags are not set
  • Loading branch information
dragonmux committed Feb 13, 2025
1 parent 36507ba commit b64e714
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions substrate/flags
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ namespace substrate
return (value & bits) == bits;
}

template<typename... values_t, typename = std::enable_if_t<(std::is_same_v<values_t, enum_t> && ...)>>
[[nodiscard]] constexpr bool excludes(const values_t ...flags) const noexcept
{
const storage_t bits{storage_t((flagAsBit(flags) | ...))};
return (value & bits) == 0U;
}

template<typename... values_t, typename = std::enable_if_t<(std::is_same_v<values_t, enum_t> && ...)>>
[[nodiscard]] constexpr bitFlags_t without(const values_t ...flags) const noexcept
{
Expand Down

0 comments on commit b64e714

Please sign in to comment.