An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# EnumBitmask
**EnumBitmask** is a library to enable bitmask operators for an enum class type.

![](EnumBitmask.png)

## 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';
}
}
```