Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to pass CTypedPtrList object

how to pass CTypedPtrList object

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestioncomtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pathi
    wrote on last edited by
    #1

    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

    T 1 Reply Last reply
    0
    • P pathi

      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

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups