9 Dec
2010
9 Dec
'10
12:04 a.m.
hello,
How to determine the actual type of the object stored in a variant?
struct S {
virtual ~S()
{}
};
struct Deriv1 : public S {
virtual ~Deriv1()
{}
};
struct Deriv2 : public S {
virtual ~Deriv2()
{}
};
struct Deriv3 : public Deriv2 {
virtual ~Deriv3()
{}
};
typedef boost::variant my_variant_t;
Deriv3 d3;
struct print_type: public boost::static_visitor<> {
template <typename T>
void operator()(const T&) const
{
std::cout<< typeid(T).name() <