Direct3D Sample Encapsulation problem

J

Jack

This sample comes from CMultiAnim sample application found in DXSDK



HRESULT CMyView::InitDeviceObjects()
{
CMultiAnimAllocateHierarchy AH;
AH.SetMA(&m_Lorry);
m_Lorry.Setup (m_pd3dDevice, m_strMeshFileNameOperator,
m_strMeshFileNameOperator, &AH); <- Don't worry about the third parameters
(fx) I have commented it out already



vector< CObjects* >::iterator itCurCP, itEndCP = m_v_pLorry.end();
for( itCurCP = m_v_pLorry.begin(); itCurCP != itEndCP; ++ itCurCP )
{
( * itCurCP )->RestoreDeviceObjects( m_pd3dDevice );
}

// If there is no instance, make sure we have at least one.
if( m_v_pLorry.size() == 0 )
{
COperator * pTiny = new COperator;
if( pTiny == NULL )
return E_OUTOFMEMORY;

HRESULT hr = pTiny->Setup( & m_Lorry, & m_v_pLorry, & m_DSound,
0.f );
}


return S_OK;
}


I encap'd CLorry into CObjects, CObjects is a generic parent class which is
now "assumed" to be allowed to act everything the mesh likes,
CLorry inherits from it. During Compilation, the following error occurred,
MyApp error C2440: 'initializing' : cannot convert from
'std::vector<_Ty,_Ax>::iterator' to
'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>'
with
[
_Ty=CLorry *,
_Ax=std::allocator<CLorry *>
]
and
[
_Ty=std::vector<CObjects *,std::allocator<CObjects
*>>::value_type,
_Diff=std::vector<CObjects *,std::allocator<CObjects
*>>::difference_type,
_Pointer=std::vector<CObjects *,std::allocator<CObjects
*>>::_Tptr,
_Reference=std::vector<CObjects *,std::allocator<CObjects
*>>::reference,
_Pointer2=std::vector<CObjects *,std::allocator<CObjects
*>>::_Tptr,
_Reference2=std::vector<CObjects *,std::allocator<CObjects
*>>::reference
]
No constructor could take the source type, or constructor overload
resolution was ambiguous

Seems nasty, but I don't know how to cope with these. The compiler version
is .NET 2002 Any hint is appreciated....
Thanks
Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

compile error msg 1

Top