Hi all, I'm defining a template class with a static method, and adding a call to that to a taskpool. However, when I run it, I get a "null this" error from parallelism.d.
Here's the minimised code: class Population(GeneType) { alias Population!(GeneType) ThisType; static void breedIndividual(ThisType oldPop, ThisType newPop) { auto mom = oldPop.selectParent(); auto pop = oldPop.selectParent(); auto kid = mom.crossbreedFrom(pop); // chance of mutation if (uniform(0, MUTATION_CHANCE) == 0) { auto oldFitness = kid.fitness(); kid.dna.mutate(); auto newFitness = kid.fitness(); } newPop.lifeforms_ ~= kid; } ThisType evolve(TaskPool p) { ... auto t = task!breedIndividual(this, newPop) ... } } The actual error message is: core.exception.AssertError@/usr/include/d2/4.6/std/parallelism.d(2723): null this There is no "this" usage that I can see, in the breedIndividual() (static) method... EXCEPT maybe for the fact that ThisType depends on the template class expansion. But that's all expanded at compile-time, and doesn't matter, right? So I'm not sure how to solve this. My first thought was to move breedIndividual out of the class, but it does depend on ThisType, as defined in the class template. Am I right that this is what's causing the "null this" error? If so, what can I do to fix it? Thanks, -- Lee