Small Vectors Proposal

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Tue Jan 30 19:07:47 PST 2007


Walter Bright wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Walter Bright wrote:
>>> Thank you, this is in line with what I thought you meant. I'm glad I 
>>> was right. Your proposal is sensible and well thought out.
>>>
>>> The only improvement I'd make is instead of:
>>>
>>> float4 f;
>>>
>>> Have:
>>>
>>> float[4] f;
>>>
>>> i.e. make static arrays of 2,3,4 dimensions have the suggested 
>>> properties. I think this is quite doable.
>>
>> I don't think this is advisable. It practically introduces an 
>> arbitrary discontinuity. Think of a template of T and N that 
>> manipulates arrays T[N]. All of a sudden, for certain values of T and 
>> N, arrays started being passed around by value.
> 
> I agree that it's a very bad idea to have such a discontinuity in ref vs 
> value. Static arrays would have to be all by value or all by ref. Then, 
> you'll just see slower speed for the larger ones.

So then arrays by ref and a stdlib template that wraps an array in a 
struct could make everyone happy.

Andrei



More information about the Digitalmars-d mailing list