Suppose I have two unrelated classes A
and B
. I also have a class Bla
that uses boost::shared_ptr
like t
http://bytes.com/topic/c/answers/832994-shared_ptr-derived-classes-ambiguitity-overloaded-functions
struct yes_type { char dummy; };
struct no_type { yes_type a; yes_type b; };
template < typename From, typename To >
class is_convertible
{
private:
static From* dummy ( void );
static yes_type check ( To );
static no_type check ( ... );
public:
static bool const value = sizeof( check( *dummy() ) ) == sizeof( yes_type );
}; // is_convertible
An in boost's shared_ptr.h, change the constructor signature to:
template
shared_ptr(shared_ptr const & r,
typename enable_if::value, void*>::type = 0
): px(r.px), pn(r.pn) // never throws
{
}