I could easily write a recursive list (list that contains lists) without templates (struct list{ list *object, *next; };), however I can't figure out a way to use an std::list (or whatever other template) in a recursive way. I do understand that this is sort of abuse and that what I really want is a binary tree. It would be very interesting if someone knew or could figure out how to do this though. I wonder if it is possible..
I've been using a list that can hold other lists for a program I'm writing in C. I use a pointer to void to hold nodes and an int to signal whether the pointer points to another list or to a "terminal" node.
I've once managed to make g++ compile forever because of recursive templates.
But you can have a member list of objects of the class itself, because a list can be empty so it doesn't require infinite memory to store an object ( and the list objects would be allocated in some other part of memory anyway )