Yet another const problem...

Mehrdad wfunction at hotmail.com
Sun May 20 22:11:32 PDT 2012


On Monday, 21 May 2012 at 05:09:34 UTC, Chris Cain wrote:
> On Monday, 21 May 2012 at 03:53:08 UTC, Mehrdad wrote:
>> Hmmm... so if you have some (complicated) random-access range, 
>> and then you want to overload opApply() (perhaps to let the 
>> user use multiple loop variables), how are you supposed to do 
>> this without duplicating your code?
>
> A random access range has opIndex and a length. Just use a 
> normal for loop in your opApply.
>
> ...
>
> for(size_t i = 0; i < this.length; ++i)
>     dg(i, this[i]);
>
> ...

d'oh... silly me


More information about the Digitalmars-d mailing list