@@ -161,7 +161,7 @@ struct FlagsHelper final {
161161 static constexpr auto Max_v{Values.back ()}; // Enum last entry
162162 static constexpr auto Min_u_v{static_cast <size_t >(Min_v)}; // Enum first entry as size_t
163163 static constexpr auto Max_u_v{static_cast <size_t >(Max_v)}; // Enum last entry as size_t
164- static_assert (Max_u_v < std::numeric_limits<U>::digits, " Max Bit is beyond allow range defered from underlying type" );
164+ static_assert (Max_u_v < std::numeric_limits<U>::digits, " Max Bit is beyond allow range deferred from underlying type" );
165165 static constexpr bool isContinuous () noexcept { return (Max_u_v - Min_u_v + 1 ) == count (); } // Is the enum continuous
166166 static constexpr UMax makeMaxRep (size_t min, size_t max)
167167 {
@@ -277,7 +277,7 @@ struct FlagsHelper final {
277277 return toLower (a) == toLower (b);
278278 }
279279
280- // Case-insensitive comparision for string_view.
280+ // Case-insensitive comparison for string_view.
281281 static constexpr bool isIEqual (std::string_view s1, std::string_view s2) noexcept
282282 {
283283 if (s1.size () != s2.size ()) {
@@ -294,7 +294,7 @@ struct FlagsHelper final {
294294 static constexpr std::string_view None{" none" };
295295 static constexpr bool hasNone () noexcept
296296 {
297- // check that enum does not contain memeber named 'none'
297+ // check that enum does not contain member named 'none'
298298 for (size_t i{0 }; i < count (); ++i) {
299299 if (isIEqual (Names[i], None)) {
300300 return true ;
@@ -306,7 +306,7 @@ struct FlagsHelper final {
306306 static constexpr std::string_view All{" all" };
307307 static constexpr bool hasAll () noexcept
308308 {
309- // check that enum does not contain memeber named 'all'
309+ // check that enum does not contain member named 'all'
310310 for (size_t i{0 }; i < count (); ++i) {
311311 if (isIEqual (Names[i], All)) {
312312 return true ;
@@ -332,7 +332,7 @@ concept EnumFlag = requires {
332332};
333333
334334/* *
335- * \brief Classs to aggregate and manage enum-based on-off flags.
335+ * \brief Class to aggregate and manage enum-based on-off flags.
336336 *
337337 * This class manages flags as bits in the underlying type of an enum (upto 64 bits), allowing
338338 * manipulation via enum member names. It supports operations akin to std::bitset
@@ -441,39 +441,42 @@ class EnumFlags
441441 }
442442
443443 // Resets a specific flag.
444- template <typename T>
445- requires std::is_same_v<T, E>
444+ template <std::same_as<E> T>
446445 constexpr void reset (T t)
447446 {
448447 mBits &= ~to_bit (t);
449448 }
450449
451450 // Tests if a specific flag is set.
452- template <typename T>
453- requires std::is_same_v<T, E>
451+ template <std::same_as<E> T>
454452 [[nodiscard]] constexpr bool test (T t) const noexcept
455453 {
456454 return (mBits & to_bit (t)) != None;
457455 }
458456
459457 // Tests if all specified flags are set.
460- template <typename ... Ts>
458+ template <std::same_as<E> ... Ts>
461459 [[nodiscard]] constexpr bool test (Ts... flags) const noexcept
462460 {
463461 return ((test (flags) && ...));
464462 }
465463
466464 // Sets a specific flag.
467- template <typename T>
468- requires std::is_same_v<T, E>
465+ template <std::same_as<E> T>
469466 constexpr void set (T t) noexcept
470467 {
471468 mBits |= to_bit (t);
472469 }
473470
471+ // Sets multiple specific flags.
472+ template <std::same_as<E>... Ts>
473+ constexpr void set (Ts... flags) noexcept
474+ {
475+ (set (flags), ...);
476+ }
477+
474478 // Toggles a specific flag.
475- template <typename T>
476- requires std::is_same_v<T, E>
479+ template <std::same_as<E> T>
477480 constexpr void toggle (T t) noexcept
478481 {
479482 mBits ^= to_bit (t);
@@ -538,8 +541,7 @@ class EnumFlags
538541 }
539542
540543 // Check if given flag is set.
541- template <typename T>
542- requires std::is_same_v<T, E>
544+ template <std::same_as<E> T>
543545 [[nodiscard]] constexpr bool operator [](const T t) const noexcept
544546 {
545547 return test (t);
@@ -564,26 +566,23 @@ class EnumFlags
564566 constexpr EnumFlags& operator =(EnumFlags&& o) = default ;
565567
566568 // Performs a bitwise OR with a flag.
567- template <typename T>
568- requires std::is_same_v<T, E>
569+ template <std::same_as<E> T>
569570 constexpr EnumFlags& operator |=(T t) noexcept
570571 {
571572 mBits |= to_bit (t);
572573 return *this ;
573574 }
574575
575576 // Performs a bitwise AND with a flag.
576- template <typename T>
577- requires std::is_same_v<T, E>
577+ template <std::same_as<E> T>
578578 constexpr EnumFlags& operator &=(T t) noexcept
579579 {
580580 mBits &= to_bit (t);
581581 return *this ;
582582 }
583583
584584 // Returns a flag set with a bitwise AND.
585- template <typename T>
586- requires std::is_same_v<T, E>
585+ template <std::same_as<E> T>
587586 constexpr EnumFlags operator &(T t) const noexcept
588587 {
589588 return EnumFlags (mBits & to_bit (t));
0 commit comments