"Michael Marcin"
Gennadiy Rozental wrote:
"Michael Marcin"
wrote in message news:etqf0t$6ea$1@sea.gmane.org... Unless I'm missing something it looks like polymorphic_downcast doesn't provide an overload for reference types... is there a reason? This makes it a little inconvenient for use.
I brought this up some time ago. No one seemed to care enough to work on docs update. As usual in many volunteering based projects ;)
R u up to it?
Is the problem the docs or the lack of an overload supporting references?
Primarily docs. Search the development mailing list archive.
Shouldn't something like this work?
#include
#include #include namespace boost { template
inline Target polymorphic_downcast( Source& x ) { BOOST_ASSERT( dynamic_cast< typename add_pointer< typename remove_reference<Target>::type >::type >( addressof(x) ) == addressof(x) ); // detect logic error return static_cast<Target>(x); } } //end namespace boost
I believe my version did something along these lines. Genandiy