Hi,
I am writing a nested table structure to mimic data returned from a
database (actually, a heirarchical recordset).
I am representing the cells where the actual data is stored, by a union:
class Cell {
union {
char* s ; //std::string s ;
long l ;
double d ;
void *t ;//Table* t ;
}cell ;
......
};
I know objects (with a copy constructor) cannot be stored directly in a
union (anyone knows the *technical* reasons why?). I am "hacking" around
this by storing a pointer to the object instead - is there anything I am
overlooking (i.e. is this dangerous?, any gotcha's I should be aware
of?) - if yes, I would appreciate an alternative solution to allow me to
stor objects (or their pointers) in a union.
I