how to pass CTypedPtrList object
-
Hi I declared CTypedPtrList object in the document class like this CTypedPtrList m_strokeList; and I want to pass this list to a function in a view by declaring reference CTypedPtrList& LineList = pDoc->m_strokeList; writeFile(filepath, LineList ); I am getting error that error C2664: 'writeFile' : cannot convert parameter 2 from 'class CTypedPtrList' to 'class CTypedPtrList' No copy constructor available for class 'CTypedPtrList' How can I solve this problem? bhikshapathi_g@semanticspace.com
-
Hi I declared CTypedPtrList object in the document class like this CTypedPtrList m_strokeList; and I want to pass this list to a function in a view by declaring reference CTypedPtrList& LineList = pDoc->m_strokeList; writeFile(filepath, LineList ); I am getting error that error C2664: 'writeFile' : cannot convert parameter 2 from 'class CTypedPtrList' to 'class CTypedPtrList' No copy constructor available for class 'CTypedPtrList' How can I solve this problem? bhikshapathi_g@semanticspace.com
You're trying to pass CTypedPtrList by value. You should use const reference instead - passing arguments by value is usually much slower and resource consuming (unless you're passing stucts containing only simple types like int or double). Change the declaration of writeFile function to this: void writeFile(CString filepath, const CTypedPtrList & list); Tomasz Sowinski -- http://www.shooltz.com.pl