New issue 37 by thehaddonyoof: Ambiguity resolution for smart pointer casts
http://code.google.com/p/cortex-vfx/issues/detail?id=37
The following code won't compile due to an ambiguity not resolved by the
smart pointer constructors. boost::intrusive_ptr deals with it by using
this sp_enable_if_convertible magic. We should either do the same or revert
to using boost::intrusive_ptr.
--------------------------------------------------------------------------
#include <IECore/RunTimeTyped.h>
namespace cit
{
// E subclasses A, D subclasses B
enum TypeId
{
ATypeId = 701000,
BTypeId,
DTypeId,
ETypeId
};
IE_CORE_FORWARDDECLARE( A );
class A : public IECore::RunTimeTyped
{
public:
IE_CORE_DECLARERUNTIMETYPEDEXTENSION( A, ATypeId, RunTimeTyped );
};
IE_CORE_FORWARDDECLARE( B );
class B : public IECore::RunTimeTyped
{
public:
IE_CORE_DECLARERUNTIMETYPEDEXTENSION( B, BTypeId, RunTimeTyped );
};
IE_CORE_FORWARDDECLARE( D );
class D : public B
{
public:
IE_CORE_DECLARERUNTIMETYPEDEXTENSION( D, DTypeId, B );
D( BPtr b ) : _b(b) {}
D( APtr a ) {}
BPtr _b;
};
IE_CORE_FORWARDDECLARE( E );
class E : public A
{
public:
IE_CORE_DECLARERUNTIMETYPEDEXTENSION( E, ETypeId, A );
};
}
int main( int, char**)
{
cit::EPtr ep = new cit::E;
cit::DPtr dp = new cit::D( ep );
return 0;
}
Comment #1 on issue 37 by andrewk.imageengine: Ambiguity resolution for
smart pointer casts
http://code.google.com/p/cortex-vfx/issues/detail?id=37
(No comment was entered for this change.)