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. Problems with CArray Updated

Problems with CArray Updated

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 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.
  • K Offline
    K Offline
    Koep
    wrote on last edited by
    #1

    Hi, i believe that i have a problem to create a instance of the following object. Declaration : CArray <CEndPointGroup*,CEndPointGroup*> m_arEndPointGroups; Add Pointer : CEndPointGroup* _pEndPointGroup = NULL; _pEndPointGroup = new CEndPointGroup(_groupname); m_arEndPointGroups.Add(_pEndPointGroup); At the last line i get an error. It seems that the arEndPointGroups-object is wrong allocated. What do i wrong ? Marco

    T J 2 Replies Last reply
    0
    • K Koep

      Hi, i believe that i have a problem to create a instance of the following object. Declaration : CArray <CEndPointGroup*,CEndPointGroup*> m_arEndPointGroups; Add Pointer : CEndPointGroup* _pEndPointGroup = NULL; _pEndPointGroup = new CEndPointGroup(_groupname); m_arEndPointGroups.Add(_pEndPointGroup); At the last line i get an error. It seems that the arEndPointGroups-object is wrong allocated. What do i wrong ? Marco

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

      What kind of error it is? Compiler error? Assert at runtime? Hardware error? Tomasz Sowinski -- http://www.shooltz.com

      Free your mind and your ass will follow.

      K 1 Reply Last reply
      0
      • T Tomasz Sowinski

        What kind of error it is? Compiler error? Assert at runtime? Hardware error? Tomasz Sowinski -- http://www.shooltz.com

        Free your mind and your ass will follow.

        K Offline
        K Offline
        Koep
        wrote on last edited by
        #3

        It's an assert error at runtime. Pointer Access Error ! i've tried only to make an array of CEndPointsGroup-Pointer. :( Marco

        T 1 Reply Last reply
        0
        • K Koep

          It's an assert error at runtime. Pointer Access Error ! i've tried only to make an array of CEndPointsGroup-Pointer. :( Marco

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

          Have a look at call stack. Where (file/line) is ASSERT located? Tomasz Sowinski -- http://www.shooltz.com

          Free your mind and your ass will follow.

          1 Reply Last reply
          0
          • K Koep

            Hi, i believe that i have a problem to create a instance of the following object. Declaration : CArray <CEndPointGroup*,CEndPointGroup*> m_arEndPointGroups; Add Pointer : CEndPointGroup* _pEndPointGroup = NULL; _pEndPointGroup = new CEndPointGroup(_groupname); m_arEndPointGroups.Add(_pEndPointGroup); At the last line i get an error. It seems that the arEndPointGroups-object is wrong allocated. What do i wrong ? Marco

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #5

            Do you have looked at CPtrArray? Maybe that helps. BTW CArray is deprecated, nonstandard and broken. You are better off using a std::vector or even a std::vector> Just remember to never use std::auto_ptr in a std:: container.

            T 1 Reply Last reply
            0
            • J jhwurmbach

              Do you have looked at CPtrArray? Maybe that helps. BTW CArray is deprecated, nonstandard and broken. You are better off using a std::vector or even a std::vector> Just remember to never use std::auto_ptr in a std:: container.

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

              jhwurmbach wrote: BTW CArray is deprecated, nonstandard and broken Nonstandard, yes. But I'd appreciate if you'd explain 'broken' and 'deprecated' part. Tomasz Sowinski -- http://www.shooltz.com

              Free your mind and your ass will follow.

              J 1 Reply Last reply
              0
              • T Tomasz Sowinski

                jhwurmbach wrote: BTW CArray is deprecated, nonstandard and broken Nonstandard, yes. But I'd appreciate if you'd explain 'broken' and 'deprecated' part. Tomasz Sowinski -- http://www.shooltz.com

                Free your mind and your ass will follow.

                J Offline
                J Offline
                jhwurmbach
                wrote on last edited by
                #7

                Broken: http://www.codeproject.com/cpp/ocarray.asp[^] or http://www.codeproject.com/cpp/carray_pitfall.asp[^] The use of 'pitfall' is the same as MS using 'issue': Politically correct term for 'ERROR' Meaning: CArray and references don't work. Deprecated: CArray is what MS had to come up with when the STL was not working, but they needed the functionality for MFC. Since the time the standard was released, there is no need to use these old nostandard CArray.

                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