diff --git a/CHANGELOG.md b/CHANGELOG.md index 44e6498..0c376c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,19 @@ All notable changes to this project will be documented in this file. -### Enum +## Next Release -- more clang-tidy fix for enum type +### Enum -## Next Release +- add operator~ and operator&= ## [0.2.4](https://github.com/repo/owner/releases/tag/0.2.4) - 2026-09-16 +### Enum + +- more clang-tidy fix for enum type + ## [0.2.3](https://github.com/repo/owner/releases/tag/0.2.3) - 2026-08-26 ### Types diff --git a/include/mstd/enum.hpp b/include/mstd/enum.hpp index 9c2dbc2..dabceed 100644 --- a/include/mstd/enum.hpp +++ b/include/mstd/enum.hpp @@ -134,12 +134,18 @@ static_cast(lhs) | static_cast(rhs) \ ); \ } \ + \ inline constexpr EnumName& operator|=(EnumName& lhs, EnumName rhs) \ { \ lhs = lhs | rhs; \ return lhs; \ } \ \ + inline constexpr EnumName operator~(EnumName value) \ + { \ + return static_cast(~static_cast(value)); \ + } \ + \ struct EnumName##FlagTest \ { \ Underlying value; \ @@ -161,6 +167,12 @@ )}; \ } \ \ + inline constexpr EnumName& operator&=(EnumName& lhs, EnumName rhs) \ + { \ + lhs = lhs & rhs; \ + return lhs; \ + } \ + \ inline constexpr bool operator!(EnumName lhs) \ { \ return !static_cast(lhs); \