Issue 37 in cortex-vfx: Ambiguity resolution for smart pointer casts

4 views
Skip to first unread message

corte...@googlecode.com

unread,
Nov 23, 2010, 10:30:19 PM11/23/10
to cortex...@googlegroups.com
Status: Accepted
Owner: john.imageengine

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;
}

corte...@googlecode.com

unread,
Dec 3, 2010, 7:40:21 PM12/3/10
to cortex...@googlegroups.com
Updates:
Labels: Type-Defect Component-IECore

Comment #1 on issue 37 by andrewk.imageengine: Ambiguity resolution for

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages