7#include "flag_bits_v.h"
22 concept bit_integral = std::is_integral_v<T> && !std::is_same_v<std::decay_t<T>,
bool>;
26 {
other &=
t } -> bit_integral;
27 {
other ^=
t } -> bit_integral;
28 {
other |=
t } -> bit_integral;
29 {
other &
t } -> bit_integral;
30 {
other ^
t } -> bit_integral;
31 {
other |
t } -> bit_integral;
58 return ((
RESULT_TYPE{ 1 } << detail::to_underlying_type(
args)) | ... | 0);
62 template <
typename INTEGRAL,
typename ENUM_TYPE>
63 requires detail::valid_flag_bits_arguments<INTEGRAL, ENUM_TYPE>
68 requires detail::valid_flag_bits_arguments<
INTEGRAL,
ARGS...>
76 requires detail::valid_flag_bits_arguments<
INTEGRAL,
ARGS...>
84 requires detail::valid_flag_bits_arguments<
INTEGRAL,
ARGS...>
89 requires detail::valid_flag_bits_arguments<
INTEGRAL,
ARGS...>
94 requires detail::valid_flag_bits_arguments<
INTEGRAL,
ARGS...>
99 requires detail::valid_flag_bits_arguments<
INTEGRAL,
ARGS...>
constexpr auto bit_count
Equal to the number of bits in the type.
constexpr RESULT_TYPE flag_bits(ARGS... args) noexcept
Takes a list of enum values that represent bit numbers (not actual bit values) and returns a value wi...
constexpr void set_flags_to(INTEGRAL &bits, bool val, ARGS... args) noexcept
Sets the bits at numbers represented by args in bits to either 0 or 1, depending on val
constexpr bool are_all_flags_set(INTEGRAL const &bits, ARGS... args) noexcept
Checks if an integral value has all of the bits at numbers represented by args set.
constexpr void toggle_flags(INTEGRAL &bits, ARGS... args) noexcept
Toggles the bits at numbers represented by args in bits
constexpr bool is_flag_set(INTEGRAL const &bits, ENUM_TYPE flag) noexcept
Checks if an integral value has the bit at number represented by flag set.
constexpr bool are_any_flags_set(INTEGRAL const &bits, ARGS... args) noexcept
Checks if an integral value has any of the bits at numbers represented by args set.
constexpr void set_flags(INTEGRAL &bits, ARGS... args) noexcept
Sets the bits at numbers represented by args in bits
constexpr void unset_flags(INTEGRAL &bits, ARGS... args) noexcept
Unsets the bits at numbers represented by args in bits
The below code is based on Sun's libm library code, which is licensed under the following license:
Primary namespace for everything in this library.