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.