How to provide this arg or functor for algorithm?

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 16 15:36:57 PDT 2015


On Sunday, 16 August 2015 at 22:22:07 UTC, Ali Çehreli wrote:
>
> // HERE:
> // Error: function deneme.func @nogc function allocates
> //        a closure with the GC
> @nogc auto func(uint[] arr, DelegateRef d)
> {
>     return arr.map!(a => d.d(a));
> }

Aren't you making another delegate in the map by using "=>" that 
needs to allocate because it uses 'd' which is out of its scope?


More information about the Digitalmars-d-learn mailing list