Bug 3999

bearophile bearophileHUGS at lycos.com
Thu Mar 25 10:03:07 PDT 2010


Lars T. Kyllingstad:
> Why not let to!int() do this?

Because if the enum is for example:
enum ulong Foo { ... 

You are casting an ulong to int and you risk losing bits of information. That's why Andrei has suggested a conversion template function, because it can (I don't know how) find the correct base type and cast the enum to it. Andrei is sometimes one step forward.

Bye,
bearophile



More information about the Digitalmars-d mailing list