Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-08-28 14:11:51


On Thu, Aug 28, 2008 at 1:00 PM, Nicolas Vanhoren
<nicolas.vanhoren_at_[hidden]> wrote:
> Oups, sorry but I misunderstood your question.
>
> Yes, for such a case like this one:
>
> Derived& derived=...
> boost::reference_wrapper<Base> reference(derived);
> reference.get().function();
>
> the call to function() will be polymorphic.
>
> What is not possible with boost::reference_wrapper is this:
>
> boost::reference_wrapper<Derived> derived(...)
> boost::reference_wrapper<Base> base = derived
>
> (and this what I does not understand in the conception of this class)
>
>
> 2008/8/28 Nicolas Vanhoren <nicolas.vanhoren_at_[hidden]>
>>
>> No.
>>
>> By the way, I would be interested to know the rationale for such a strange
>> behavior. If anyone knows something about that...
>>
>> 2008/8/27 Robert Dailey <rcdailey_at_[hidden]>
>>>
>>> Does boost::reference_wrapper provide polymorphic behavior? For
>>> example, if I have a boost::reference_wrapper to a base type, and I
>>> assign a derived type to it, will the function calls be polymorphic?

Thank you, this is exactly what I wanted to know.


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