Hi,
I have a project with two (involved) classes. A "lowerclass.h" and a "upperclass.h"(has a std::list of lowerclass elements). Until now i only had included lowerclass in upperclass and everything worked fine, but since i included upperclass in lowerclass, my list of lowerclass "is not a valid template type argument for parameter".
1 2 3 4 5
#ifndef LOWERCLASS_H
#define LOWERCLASS_H
#include"upperclass.h"
class lowerclass{...};
#endif
good point nonsence.
You can declare a class before defining it, i.e.
1 2 3 4 5 6
// do not include lowerclass.h
class lowerclass; // declaration
class upperclass { // definition
}
std::list<lowerclass> would not work yet, because it requires a definition ( though std::list<lowerclass*> would ).
I did not find a general solution for this existential issue. Some people say that when this situation arise, it is a symptom of code mess anyway.