primitive vector types (permutation syntax)
Christopher Wright
dhasenan at gmail.com
Sun Feb 22 05:51:10 PST 2009
Denis Koroskin wrote:
> On Sun, 22 Feb 2009 14:02:53 +0300, Mattias Holm
> <hannibal.holm at gmail.com> wrote:
>
>> I think that the following would work reasonably well:
>>
>> allow the [] operator for arrays to take comma separated lists of
>> indices.
>>
>> So the OpenCL like statement:
>>
>> v.xyzw = v2.wzyx;
>>
>> will be written as:
>>
>> v[0,1,2,3] = v2[3,2,1,0];
>
> How would you implement it for user-defined types?
T[] opIndex(int[] indices) { ... }
void opIndexAssign(int[] indices, T[] values) { ... }
More information about the Digitalmars-d
mailing list