Boost logo

Boost Users :

From: Nicolas Vanhoren (nicolas.vanhoren_at_[hidden])
Date: 2008-08-28 14:00:54


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?
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>



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