Wrap those types into classes, like so:
struct common{
};
struct yellow : public common, YELLOW_LEM {
};
struct pink : public common, PINK_LEM {
};
struct melon : publik common, MELONADE {
};
struct common{
};
struct yellow : public common, YELLOW_LEM {
};
struct pink : public common, PINK_LEM {
};
struct melon : publik common, MELONADE {
};
To copy to clipboard, switch view to plain text mode
And then:
std::list<common*> list;
std::list<common*> list;
To copy to clipboard, switch view to plain text mode
Or simply:
union { YELLOW_LEM *yellow; PINK_LEM *pink; MELONADE *melon; } lemonades;
std::list<lemonades> list;
union { YELLOW_LEM *yellow; PINK_LEM *pink; MELONADE *melon; } lemonades;
std::list<lemonades> list;
To copy to clipboard, switch view to plain text mode
You'll have to cast to appropriate classes anyway, so both of this approaches are limited. You'd have to create your own set of classes and wrap each method of each of those pointers directly into a class, so that they share a common interface and have ability for run time type information.
Bookmarks