I think it would be a better idea to change all the Thread classes to have the same base class. It wouldn't take that long, because the changes need be made to only a small portion of the code, and plus, it's good programming practise to share a base class between classes that have some common functionality.
All you need to do is add the base class in, like so:
Code:
class ThreadBase
{
public:
ThreadBase() {}
~ThreadBase() {}
};
And change the Thread class declarations like so:
Code:
class ThreadX : public ThreadBase
{
public:
//etc
Now, you can store a pointer to a ThreadBase object, and when you 'delete' it, the magical V-Tables (or whatever) will ensure that the appropriate destructor for that particular object is run.
I don't think a solution with templates exists here, but someone else may know of a way.