vamsi krishna wrote:
I tried this and It worked for me on g++ (3.4.4).
#include<list> using namespace std;
std::list<class P*> P; /*I tried for list template, it should work for pair also*/ typedef class P* Y; typdef std::list<Y> P_new;
/*P_new is the class what u are expecting.*/
Unfortunately it doesn't quite work though it took me a while to work out why: I hadn't thought of declaring a class inside the brackets <...>. There are two classes P here I think: one declared but not defined and the other defined as std::list<struct P*>. The problem is that neither has type std::list<std::list<...>*> that I need. The code compiles correctly because the declarations are correct. You can construct a list of type std::list<std::list<struct P*>*> but you can't do anything with the objects it contains because their class has never been defined. Still it proves there are things I hadn't thought of trying.. -- JDL