Extend vector ops to boolean operators?

James Miller james at aatch.net
Tue Mar 6 15:57:02 PST 2012


On 7 March 2012 10:58, Kapps <opantm2+spam at gmail.com> wrote:
> On Tuesday, 6 March 2012 at 20:28:40 UTC, H. S. Teoh wrote:
>>
>> It'd be really cool if I could do this:
>>
>>        void func(int[] vector, int[] bounds) {
>>                assert(vector[] >= 0 && vector[] < bounds[]);
>>
>>                ...
>>        }
>>
>> Is there any reason why we shouldn't implement this?
>>
>>
>> T
>
>
> Would this be possible with UFCS?
>
> int opCmp(T)T([] array, T element) { ... }
> int opCmp(T)(T[] array1, T[] array2) { ... }

I like this idea, at least adding an opSliceCmp operator-overload
would do as a start, I think thats the correct name for it. I can't be
bothered to check.

--
James Miller


More information about the Digitalmars-d mailing list