How to define opCast from native types
bearophile
bearophileHUGS at lycos.com
Fri Feb 7 18:35:56 PST 2014
Cherry:
> alias BitVector!48 bitv48;
> long ll;
> bitv48 foo = cast(bitv48) ll; // I need cast here
In D types like bitv48 usually (should) start with an uppercase,
and the alias syntax with = is now preferred.
Is this good enough?
alias Bitv48 = BitVector!48;
ulong ull;
auto foo = ull.toBitV!Bitv48;
Where toBitV is a little function of yours.
Bye,
bearophile
More information about the Digitalmars-d
mailing list