Is there anyway to make opApply @nogc?

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 20 09:04:34 PDT 2016


On Monday, 20 June 2016 at 15:47:44 UTC, Gary Willoughby wrote:
> On Monday, 20 June 2016 at 15:27:32 UTC, Adam D. Ruppe wrote:
>> On Monday, 20 June 2016 at 15:13:53 UTC, Gary Willoughby wrote:
>>> I think the problem is that the delegate which is required by 
>>> opApply is allocated using the GC.
>>
>> make the delegate in opApply scope
>>
>> int opApply(scope int delegate(whatever) dg)
>
> What effect does this have? and how does it beat the GC?

Found the explanation here:

http://stackoverflow.com/questions/4711309/meaning-of-scope-in-d-for-a-parameter

I give it a go. Thanks.


More information about the Digitalmars-d-learn mailing list