We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 40a4897 commit 76bb94fCopy full SHA for 76bb94f
1 file changed
include/type_safe/flag_set.hpp
@@ -559,6 +559,17 @@ class flag_set
559
return flags_.to_int();
560
}
561
562
+ template <typename UnaryFunction>
563
+ constexpr void for_each(UnaryFunction f) {
564
+ auto m = flags_.to_int();
565
+ using U = decltype(m);
566
+ for (U i = 0; i < std::numeric_limits<U>::digits; ++i) {
567
+ if ((m & (U{1} << i)) != U{0}) {
568
+ f(static_cast<Enum>(i));
569
+ }
570
571
572
+
573
//=== bitwise operations ===//
574
/// \returns A set with all the flags flipped.
575
constexpr flag_set operator~() const noexcept
0 commit comments