opApply @safety

Chris Wright via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 29 09:44:34 PST 2016


I want to create an opApply for a type.

I've marked my code @safe, because everything I wrote was @safe. The body 
of opApply is @safe, but it calls a delegate that may or may not be @safe.

How do I make it so I can iterate through this type safely and systemly?

I want to support iteration like:

foreach (string key, string value; collection) {}
foreach (size_t i, string key, string value; collection) {}


More information about the Digitalmars-d-learn mailing list