Rotating though an enum idiom

Spacen Jasset spacenjasset at yahoo.co.uk
Sat Sep 6 15:09:24 PDT 2008


Is there a way to "rotate" though and enum; So that:


enum RenderMode { POINT, LINE, FILL }

renderMode = POINT;
fn(renderMode) gives LINE
fn(renderMode) gives FILL
fn(renderMode) gives POINT
and so on, in rotation.

I would normally use some sort of modulo operation on an int to do this, 
but I wonder if there is another way.


More information about the Digitalmars-d-learn mailing list