I'd like to suggest some stuff to add to bitmanip: the concept of set of enums elements. The idea is simple: the enum members are stored in a set according to their rank. So instead of OR-ing some consecutive values as usually done in C or C++ it's possible to do the same with the complex enums (based on a floating point type for example, or with some non-consecutives integer values).

I've written a module which demonstrates the concept. Tell me your thoughts about this idea. By the way, I'm a relatively a new comer in D, I've read on the wiki that there is a procedure to follow in to propose a new phobos module, but in this case I'd just like to propose some additions, not a new module, so be tolerant if I don't behave like expected...

The module which illustrates what I'd like to be added:
https://github.com/BBasile/BitSets

Rationale: The best argument I can give is that this is inspired by a Delphi language feature (the Sets) widely used. It keeps a logical relationship between the members of an enum in a single container (instead of having many fields related to the same context, it uses a single one). That's also very type-safe because it's based upon a template, the traits and a parametric struct.

Reply via email to