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@gmail.com>
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@gmail.com>

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@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users