opDollar()
Don
nospam at nospam.com
Mon May 2 11:27:45 PDT 2011
Dmitry Olshansky wrote:
> On 26.03.2011 11:03, Caligo wrote:
>> "In the expression a[<expr 1>, ...,<expr k>], if $ occurs in<expr
>> i>, it is rewritten as a.opDollar!(i)()." -- TDPL, pg 380
>>
>> Is that correct? if so, could some one give an example code? I don't
>> understand the need for the parameter.
>>
>> Also, what is the signature for opDollar() in a struct. I'm getting
>> errors trying to implement this.
> That parameter means number of dimension. When implementing some kind of
> multidimensional array (e.g. an 2D raster Image) you'd have:
> img[$-1, $-1] = lastValue; // the first dollar should resolve to
> "width", the second to "height"
>
> Now speaking of it's implementation - it's quite broken.
It's not broken -- it's not implemented at all!
> The relevant bug report is
> http://d.puremagic.com/issues/show_bug.cgi?id=3474 (vote up!)
> Still it's not considered to be a critical one, since you can workaround
> it by:
> img[img.width-1,img.height-1] = lastValue;
>
More information about the Digitalmars-d-learn
mailing list