$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2006-10-06 11:00:27
Vaclav Vesely wrote:
> Hi,
> 
> I would like to do somethink like this:
> 
>     class Base {...}
>     class Derived: public Base {...}
> 
>     optional<Base> x = Derived();
>     y->call_virtual_functions()
> 
> Current design of boost::optional doesn'g support this. But I wonder if it's 
> to possible to extend it.
> 
> I created simple prototype to verify the technique (see attachment). It 
> works this way:
> 
> optional<BaseT>
> - has attribut _value_holder of type value_holder<BaseT>*
> - _value_holder points to the instance of derived_value_holder<BaseT, 
> DerivedT>, where DerivedT is the type of stored value
> 
It looks a lot like Boost.Any.
Have you looked at it?
Fernando Cacciola
SciSoft
http://fcacciola.50webs.com