https://github.com/avakar/bitflags
Tiny header-only library providing bitwise operators for enums in C++11
https://github.com/avakar/bitflags
cpp cpp11 enums flags
Last synced: about 2 months ago
JSON representation
Tiny header-only library providing bitwise operators for enums in C++11
- Host: GitHub
- URL: https://github.com/avakar/bitflags
- Owner: avakar
- License: 0bsd
- Created: 2022-01-27T21:50:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-27T21:57:48.000Z (over 3 years ago)
- Last Synced: 2025-04-12T19:57:47.073Z (about 2 months ago)
- Topics: cpp, cpp11, enums, flags
- Language: C++
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bitflags
Tiny header-only library providing bitwise operators for enums in C++11.
## Getting started
Import the operators from namespace `avakar::bitflags` and
add an enumerator called `none` to your flag-like enum.```cpp
#include
using namespace avakar::bitflags;enum myflags {
none,
flag1 = (1<<0),
flag2 = (1<<1),
flag3 = (1<<2),
};
```Now you can use bitwise operators on your enum.
```cpp
myflags fl = flag1 | flag2;
```