Makes Sense. The example I'm playing with is to get familiar with
templates and the calling that I was trying to simplify is better
represented by,
template <class T>
class Balls {
public:
list<Sticks<T> *> s;
}
template <class T>
class Sticks {
public:
list<Balls<T> *> b;
}
So I want a list of pointers to the other templated class. I think this
means that I end up with a similar problem to what you described as s
and b are not pointers so the compiler doesn't know the size of the
list inside the class.
No, that's not a problem. You're declaring a list which will hold pointers,
which is fine. The list size is dynamic; it grows when you add items to it.
Is that the actual code you have?
One problem is that you're missing semicolons (
after the class
definitions. Also, you'd need to forward declare "template <class T> class
Sticks;" before the Balls class. The it will compile fine.
But how do you try to use this code? What's T?
You could easily have code like this:
Sticks<Balls<int> > ballsticks;
Balls<Sticks<int> > stickballs;
Is that the kind of thing you meant to do?
-Howard