"shared_ptr<T> can be implicitly converted to shared_ptr<U> whenever T* can be implicitly converted to U*. In particular, shared_ptr<T> is implicitly convertible to shared_ptr<T const>, to shared_ptr<U> where U is an accessible base of T, and to shared_ptr<void>. "

http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/shared_ptr.htm

At 07:47 AM 8/21/2008, you wrote:
Hi there,

after making what I then thought was a bad mistake, I discovered that the
code below actually works (gcc 4.3.1, OpenSUSE 11 64bit, Boost 1.36). I.e.,
there is an implicit cast from shared_ptr<derived> to shared_ptr<base> to
make it fit the function argument, although both represent different types.

Is this intended behaviour (i.e. portable) ? I did not find a corresponding
description in the docu.