But it's std.parallelism's task... And how can I use get!T if I don't know the type of the task?
2015-08-01 19:02 GMT+02:00 Adam D. Ruppe via Digitalmars-d-learn < [email protected]>: > On Saturday, 1 August 2015 at 16:41:54 UTC, maarten van damme wrote: > >> 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? >> > > > You can get a type from a Variant with the get!T method then call it. > > 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. >
