Boost C++ Libraries: Ticket #942: sort of dynamic_cast for smart pointers https://svn.boost.org/trac10/ticket/942 <pre class="wiki">would not it be cool to have such feature ? so i can write shared_ptr&lt;A&gt; pA=new B(); shared_ptr&lt;B&gt; pB=downcast&lt;B&gt;(pA); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/942 Trac 1.4.3 beman_dawes Fri, 06 Jul 2001 13:46:25 GMT status changed https://svn.boost.org/trac10/ticket/942#comment:1 https://svn.boost.org/trac10/ticket/942#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=51042 I'd need to see a more complete proposal before taking any action on this one. You might want to post something on the main list. --Beman </pre> Ticket nobody Mon, 09 Jul 2001 05:39:00 GMT <link>https://svn.boost.org/trac10/ticket/942#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/942#comment:2</guid> <description> <pre class="wiki">Logged In: NO &gt;I'd need to see a more complete proposal before taking any &gt;action on this one. You might want to post something on &gt;the main list. Sorry, i don't know what 'main list' is, so i'll try to explain here. In two words, i want a function with signature template &lt;class To,class From&gt; smart_ptr&lt;To&gt; downcast(smart_ptr&lt;From&gt;) which will attempt to cast From* to To* (the way dynamic_cast doing this) and will return smart_ptr&lt;To&gt; sharing same reference count with smart_ptr&lt;From&gt; in case of success. If the cast is illegal, the function will return null-smart_ptr&lt;To&gt;. For me, such a function is very convenient and absolutely necessary in some cases. </pre> </description> <category>Ticket</category> </item> </channel> </rss>