opApply ref and "const" iterators

2009-09-28 Thread gzp
Hello, Iám new to D so i might be all wrong. Given the code: class Foo { int opApply( int delegate(ref real) dg ) {...} //A. int opApply( int delegate(real) dg ) {...} // B, } ... Foo foo = new Foo; foreach( a; foo ) {...} // 1. foreach( ref a; foo ) {..

Re: opApply ref and "const" iterators

2009-09-28 Thread Jarrett Billingsley
On Mon, Sep 28, 2009 at 6:58 PM, gzp wrote: > Hello, > > Iám new to D so i might be all wrong. Given the code: > > class Foo { >        int opApply( int delegate(ref real) dg ) {...} //A. >        int opApply( int delegate(real) dg ) {...} // B, > } > > ... >        Foo foo = new Foo; >        for

Re: opApply ref and "const" iterators

2009-09-28 Thread Denis Koroskin
On Tue, 29 Sep 2009 02:58:01 +0400, gzp wrote: Hello, Iám new to D so i might be all wrong. Given the code: Hello and welcome to the D world! class Foo { int opApply( int delegate(ref real) dg ) {...} //A. int opApply( int delegate(real) dg ) {...} // B, } ... Foo

Re: opApply ref and "const" iterators

2009-09-29 Thread Steven Schveighoffer
On Mon, 28 Sep 2009 18:58:01 -0400, gzp wrote: Hello, Iám new to D so i might be all wrong. Given the code: class Foo { int opApply( int delegate(ref real) dg ) {...} //A. int opApply( int delegate(real) dg ) {...} // B, } ... Foo foo = new Foo; foreach( a; fo