Small Vectors Proposal

Deewiant deewiant.doesnotlike.spam at gmail.com
Thu Feb 1 10:01:13 PST 2007


Andrei Alexandrescu (See Website For Email) wrote:
> Mikola Lysenko wrote:
>> 3. Casting rules
>>
>> Vector types will obey the same casting rules as their base type
>> within a single dimension.  It is not possible to use a cast to change
>> the dimension of a vector.
>>
>> cast(float2)(int2(1, 2));    //ok
>> cast(int)(float2(3, 4));    //error, int is not the same dimension as float2
>> real3(a, b) + ireal(c, d);    //ok, type of expression is creal3
> 
> opCast. Yup, check that sucker too.
> 

I presume the original proposal would have allowed both cast(float2)(int2(1, 2))
and cast(real2)(int2(1, 2)). Currently, however, we can have only one opCast per
struct/class.

Is this a planned D 2.0 change I've missed, or how would this work?



More information about the Digitalmars-d mailing list