Hello.

I want to create some finite algebra, where the elements are enumerated but operations on them are defined (with composition tables).

e.g.:

enum color = { white, yellow, red, blue, orange, violet, green, black };

color a = blue;
a += yellow;
assert(a == green);

is this possible in D?

Because, if I define a struct, I can define operation overloads, but then I have no enumeration of possible values. But if I enumerate, I cannot
overload operations.
What have I missed?
  • overloading operations fo... Dominikus Dittes Scherkl via Digitalmars-d-learn

Reply via email to