generic array functions and vector operations

Bent Rasmussen IncredibleShrinkingSphere at Gmail.com
Mon Aug 18 18:32:12 PDT 2008


As Steven writes, I'd prefer optimal efficiency (who wouldn't). Of course in 
a transitional phase dynamic arrays offer the compelling advantage of a 
smooth migration path to static arrays. On the other hand I have no idea 
when or if static array return types will be allowed and so I may as well 
stick with the struct based approach, which have the desired efficiency, 
while "waiting for Cousteau". :-)

Bent

"Walter Bright" <newshound1 at digitalmars.com> skrev i meddelelsen 
news:g8cj44$1qmf$2 at digitalmars.com...
> Bent Rasmussen wrote:
>> I wanted to test out array operations and create some nice generic 
>> functions for dealing with vectors. One function is defined as
>>
>> A[n] lerp(A, uint n)(A t, A[n] a, A[n] b)
>> {
>>    return a[] + t * (b[] - a[]);
>> }
>
> Just write it as:
>
> A[] lerp(A)(A t, A[] a, A[] b)
>   ... 




More information about the Digitalmars-d mailing list