Return enum-templated struct based on runtime value
bearophile
bearophileHUGS at lycos.com
Fri Apr 5 11:00:54 PDT 2013
Sebastian Graf:
> I wonder if there is a good way to dry up this:
I suggest to improve that code a lot.
For machineWord there is:
alias machineWord = Select!(machine == Machine.I386, uint, ulong);
This:
(1 << 32)
Gives:
Error: shift by 32 is outside the range 0..31
Generally it's better to use named enums and final switches,
where possible.
Keep in mind built-in integral numbers have the max attribute.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list