<div dir="ltr">But it's std.parallelism's task...<div>And how can I use get!T if I don't know the type of the task?</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-01 19:02 GMT+02:00 Adam D. Ruppe via Digitalmars-d-learn <span dir="ltr"><<a href="mailto:digitalmars-d-learn@puremagic.com" target="_blank">digitalmars-d-learn@puremagic.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Saturday, 1 August 2015 at 16:41:54 UTC, maarten van damme wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I was afraid I would have to do that. Templatizing the class on the value doesn't work as I later on want to create a hashmap of these classes. When I assign a task to a variant, how do I call .yieldForce later on?<br>
</blockquote>
<br>
<br></span>
You can get a type from a Variant with the get!T method then call it.<br>
<br>
But actually, maybe Task should just be an interface with the yieldForce method then you create classes that implement it and pass them to the constructor. Then there's no need for templates or casting at all.<br>
</blockquote></div><br></div>