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. Question about CArray.

Question about CArray.

Scheduled Pinned Locked Moved C / C++ / MFC
helpbusinesstutorialquestion
3 Posts 3 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.
  • M Offline
    M Offline
    Michael Liu
    wrote on last edited by
    #1

    My code like this: CUIntArray CMyClass::CMyFunc(CUIntArray caArrayA, CUIntArray caArrayB) { return m_ncaBinaryResult; } CMyClass derived from CObject. CUintArray is almost same as CArray, but only contain UINT elements. I got "class 'CUIntArray' : no copy constructor available" compile error at the 'return m_ncaBinaryResult'. How to fix it. Thanks. mIchAel Liu __________________________________________________________ The secret of business is to know something that nobody else knows. ;)

    T 1 Reply Last reply
    0
    • M Michael Liu

      My code like this: CUIntArray CMyClass::CMyFunc(CUIntArray caArrayA, CUIntArray caArrayB) { return m_ncaBinaryResult; } CMyClass derived from CObject. CUintArray is almost same as CArray, but only contain UINT elements. I got "class 'CUIntArray' : no copy constructor available" compile error at the 'return m_ncaBinaryResult'. How to fix it. Thanks. mIchAel Liu __________________________________________________________ The secret of business is to know something that nobody else knows. ;)

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

      Pass the arguments as const references - it's much more efficient, since compiler doesn't need to create copies of arguments. You should also avoid returning objects like CArray by value - rather, pass 3rd argument as non-const reference. Tomasz Sowinski -- http://www.shooltz.com

      *** Vodka. Connecting people. ***

      A 1 Reply Last reply
      0
      • T Tomasz Sowinski

        Pass the arguments as const references - it's much more efficient, since compiler doesn't need to create copies of arguments. You should also avoid returning objects like CArray by value - rather, pass 3rd argument as non-const reference. Tomasz Sowinski -- http://www.shooltz.com

        *** Vodka. Connecting people. ***

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Tomasz is cool! it has to be said, I see him answering so many questions!

        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