How would you check for the object type when looping std::list?
class A
{
int x; int y;
public:
A() {x = 1; y = 2;}
};
class B
{
double x; double y;
public:
B() {x = 1; y = 2;}
};
class C
{
float x; float y;
public:
C() {x = 1; y = 2;}
};
int main()
{
A a; B b; C c;
list <boost::variant<A, B, C>> l;
l.push_back(a);
l.push_back(b);
l.push_back(c);
list <boost::variant<A, B, C>>::iterator iter;
for (iter = l.begin(); iter != l.end(); iter++)
{
//check for the object type, output data to stream
}
}