|
Boost Users : |
From: Gross, Steve (SGross_at_[hidden])
Date: 2007-08-14 14:34:02
Is there a way to use any_cast for polymorphic types? For instance,
let's say I've got a Base class and a Derived class. I want to be able
to any_cast a Derived * to a Base * successfully, like so:
class Base { virtual ~Base() {} };
class Derived : public Base { virtual ~Derived() {} };
Derived d;
boost::any a = &d;
boost::any_cast<Base*>(a); // Will NOT throw an exception
Thanks!
--Steve
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net