casting from variant

cal callumenator at gmail.com
Sat Aug 4 20:40:12 PDT 2012


In the following code:

Variant j;
j = 1.0; // make it a double
auto x = cast(float)(j.get!(double)); // fail: cannot cast 
j.get!(double)
auto y = cast(float)x; // fine

The first attempt to cast doesn't compile, but the second 
less-direct cast is OK. Is that a bit strange?


More information about the Digitalmars-d-learn mailing list