|
Boost : |
From: Vaclav Vesely (vaclav.vesely_at_[hidden])
Date: 2006-10-10 04:11:53
Fernando Cacciola wrote:
>
> Vaclav Vesely wrote:
>> I would like to do somethink like this:
>>
>> class Base {...}
>> class Derived: public Base {...}
>>
>> optional<Base> x = Derived();
>> y->call_virtual_functions()
>
> It looks a lot like Boost.Any.
> Have you looked at it?
boost::any doesn't support derived classes as well. For example:
any x = Derived();
any_cast<Base>(x).virtual_function(); // throws bad_any_cast
And moreover boost::any is too general. I want to store only values of Base
and its derived classes.
Regards,
Vaclav
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk