What is a sink delegate?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 30 10:27:08 PDT 2014


On Tuesday, 30 September 2014 at 17:22:44 UTC, Gary Willoughby 
wrote:
> What is a sink delegate?

Instead of

string toString() { return "foo"; }

for example, you would use:

void toString(void delegate(string) sink) { sink("foo"); }

The sink argument there is then free to view and discard the data 
or to make a private copy using whatever scheme it desires.


More information about the Digitalmars-d-learn mailing list