Registry / utility / flagpp

flagpp

JSON →
library3.1.0vcpkgunverified

A C++20 library that provides opt-in bit-wise operations for arbitrary enum classes.

vcpkg install flagpp
INSTALL
IMPORT
SIG · FLAGPP
F
flagpp
utilitycppv3.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

flagpp/flagpp.hpp
#include <flagpp/flagpp.hpp>

Define an enum class with bitwise operations using flagpp

#include "flagpp/flagpp.hpp" #include <iostream> enum class Flags : unsigned { None = 0, Read = 1 << 0, Write = 1 << 1, Execute = 1 << 2 }; // Enable bitwise operations for this enum FLAGPP_ENABLE(Flags); int main() { Flags f = Flags::Read | Flags::Write; if (f & Flags::Read) { std::cout << "Read permission set" << std::endl; } f |= Flags::Execute; std::cout << "Combined flags: " << static_cast<unsigned>(f) << std::endl; return 0; }
Debug
Known issues
gotchaflagpp requires C++20 and the FLAGPP_ENABLE macro must be invoked in the global namespace for each enum class.
fix
Ensure your compiler supports C++20 and place FLAGPP_ENABLE(EnumName) outside any namespace.
affects: *
Upgrade
Version history
3.1.0latest on vcpkg
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

flagpp — pip install flagpp · libregistry