mercredi 4 mars 2020

How to use typedef recursively?

I want to write a program about courses a person can take each semester.I want to define a data type called CourseTable which is a vector of a struct called Course but in this struct I also have a "prerequisites" variable whose type I've decided to be CourseTable.

typedef vector<Course> CourseTable ;
struct Course
{
  ....
  CourseTable prerequisites;
};

I get compilation error in either order I put these two declarations.Do you have any suggestions what I should do?

Aucun commentaire:

Enregistrer un commentaire