generic array functions and vector operations
Bent Rasmussen
IncredibleShrinkingSphere at Gmail.com
Mon Aug 18 20:18:11 PDT 2008
I see that the language specification likens tuples to [static] arrays and
states that it may become possible to return tuples from functions, as well
as using operators on them. As such, might one imagine a future with vector
operations on tuples as well? Not that I see any reason to use them over
static arrays per se - array literals are more straight-forward, at least as
it stands now.
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