https://github.com/reputeless/enumbitmask
A C++ library to enable bitmask operators for an enum class type
https://github.com/reputeless/enumbitmask
bitmask cpp cpp17 enum
Last synced: 6 months ago
JSON representation
A C++ library to enable bitmask operators for an enum class type
- Host: GitHub
- URL: https://github.com/reputeless/enumbitmask
- Owner: Reputeless
- License: cc0-1.0
- Created: 2020-04-26T12:56:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-27T13:09:00.000Z (over 5 years ago)
- Last Synced: 2025-04-16T13:35:51.175Z (6 months ago)
- Topics: bitmask, cpp, cpp17, enum
- Language: C++
- Homepage:
- Size: 45.9 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EnumBitmask
![]()
**EnumBitmask** is a library to enable bitmask operators for an enum class type.
## Examples
```C++
# include
# include "EnumBitmask.hpp"enum class OpenMode
{
Append = 1,
Binary = 2,
Input = 4,
Output = 8,
};
DEFINE_BITMASK_OPERATORS(OpenMode)int main()
{
constexpr OpenMode openMode = OpenMode::Binary | OpenMode::Input;
if (openMode & OpenMode::Binary)
{
std::cout << "Binary mode" << '\n';
}
}
```