opSlice and $

Oskar Linde oskar.lindeREM at OVEgmail.com
Tue Sep 11 12:27:44 PDT 2007


Sean Kelly wrote:
> Russell Lewis wrote:
>> It appears to me, looking at the spec, that there isn't a way to 
>> support the use of $ in operator overloading.  Is there anything I've 
>> overlooked?  What I'm looking for, of course, is to be able to do:
>>
>> class MyClass {....}
>>
>> MyClass c = new MyClass;
>> auto x = c[1..$];
> 
> The '$' symbol should map to "size_t length()" when used with opSlice, 
> but at the moment I don't think this is the case.

The problem how that generalizes to multidimensional slicing:
c[1..$, 2..$]

-- 
Oskar



More information about the Digitalmars-d mailing list