enum_set

[full]

A library of type safe sets over fixed size collections of types or values, including methods for accessing, modifying, visiting and iterating over those.

Build status Code coverage GitHub release License

A library of type safe sets over fixed size collections of types or values, including methods for accessing, modifying, visiting and iterating over those.

Rationale

Enums are great, as long as you use them to represent individual flags or options. If you want to represent a set of options using an enumeration, one would typically let the values of the enumeration take on powers of two and then "or" them together

enum class option
{
    A = (1 << 0),
    B = (1 << 1),
    C = (1 << 2)
};

int operator|(option lhs, option rhs)
{
    return static_cast<int>(lhs) | static_cast<int>(rhs);
}
... More
license MIT
project enum_set
url github.com/cdeln/cpp_enum_set
src-url github.com/cdeln/cpp_enum_set
topics enum setstype setstype safetyfixed size containers
1 Version
version 0.1.0-a.1
repository pkg:cppget.org/alpha
depends 2; doctest, magic_enum
requires 1; c++ >= 17