I wish to use structures to create a datatype which contains other references of an array of the structure itself OR structures of another type. Using templates will obviously result in an infinite declaration of the type itself when the reference is of same generic type. My current solution is to explicitly declare another struct type and the struct type of itself. I was wondering if there was a more clever solution (using structs).
struct Transform
{
float x;
float y;
float z;
float qx;
float qy;
float qz;
float qw;
};
struct Pattern
{
enum type{ linear, rectangular, circular };
char name[20];
int id;
Transform t[PATTERN_SIZE];
};
struct Group
{
enum type{ pattern, group };
char name[20;
int id;
Group *g[20];
Pattern *p[20];
};
Aucun commentaire:
Enregistrer un commentaire