How to export a deduced template type to the enclosing scope?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 25 05:40:47 PDT 2014


On 9/23/14 7:12 PM, Ali Çehreli wrote:

> Can we get rid of the ResultT template parameter? Tricks with variadic
> templates, the with statement, etc. come to mind but I could not manage it.

I don't think so.

yield just returns control back to another fiber. It's not an entry point.

What you *could* do is match an "expectation" function with the yield 
result. In other words, at the place where you expect the fiber to yield 
you a result, pass in a pointer to a value for the yield to fill in:

expectYield(&someint); -> fiber runs, yields an int, and then when this 
yields the result, someint is filled in.

I'm not super familiar with how D fibers work, or fibers in general. But 
perhaps it's the 'call' function that could be made to take parameters.

-Steve


More information about the Digitalmars-d-learn mailing list