auto pipe(T, alias oh)() { import std.concurrency: Generator, yield; return new Generator!T({ struct OutputRange { void put(T item) { yield(item); } } oh(OutputRange()); }); }
Here's how to do it using context switches. There ought to be a
way to manually pass specific state around to keep that from
happening, but probably not since there's no interface to pause
something writing to an OutputRange.
- std.range pipelike interface, inverting Outpu... cy via Digitalmars-d-learn
- Re: std.range pipelike interface, invert... cy via Digitalmars-d-learn
- Re: std.range pipelike interface, invert... ikod via Digitalmars-d-learn