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. Problem in accessing nodes of a list in Release build

Problem in accessing nodes of a list in Release build

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestionannouncement
5 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.
  • A Offline
    A Offline
    Aryan S
    wrote on last edited by
    #1

    Hi, I am facing a problem while accessing values in a std::list in release build. The code I am using is like struct _STRUCT_ABC { int iIdCount; string szName; }STRUCTABC, *PSTRUCTABC; list<<PSTRUCTABC>>:: iterator ittr = g_ABCList.begin(); // g_ABCList is a golbal list with PSTRUCTABC int iCount = ittr._Ptr->_Myval->iIdCount; // Works fine with _DEBUG prepocessor but does not work in release mode if _DEBUG prepocessor is not defined. Now according to VS2005 compiler _Ptr is a private variable if _DEBUG is not defined. In that case how to access the values inside the list? Thanks in advance.

    CPalliniC C 2 Replies Last reply
    0
    • A Aryan S

      Hi, I am facing a problem while accessing values in a std::list in release build. The code I am using is like struct _STRUCT_ABC { int iIdCount; string szName; }STRUCTABC, *PSTRUCTABC; list<<PSTRUCTABC>>:: iterator ittr = g_ABCList.begin(); // g_ABCList is a golbal list with PSTRUCTABC int iCount = ittr._Ptr->_Myval->iIdCount; // Works fine with _DEBUG prepocessor but does not work in release mode if _DEBUG prepocessor is not defined. Now according to VS2005 compiler _Ptr is a private variable if _DEBUG is not defined. In that case how to access the values inside the list? Thanks in advance.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Aryan S wrote:

      int iCount = ittr._Ptr->_Myval->iIdCount;

      you don't like the public interface of the list (and its iterator), do you?

      int iCount = ittr->iIdCount;
      int iCount = (*ittr)->iIdCount;

      [thanks to] Cedric's post [/thanks to] :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      modified on Monday, June 23, 2008 5:32 AM

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • A Aryan S

        Hi, I am facing a problem while accessing values in a std::list in release build. The code I am using is like struct _STRUCT_ABC { int iIdCount; string szName; }STRUCTABC, *PSTRUCTABC; list<<PSTRUCTABC>>:: iterator ittr = g_ABCList.begin(); // g_ABCList is a golbal list with PSTRUCTABC int iCount = ittr._Ptr->_Myval->iIdCount; // Works fine with _DEBUG prepocessor but does not work in release mode if _DEBUG prepocessor is not defined. Now according to VS2005 compiler _Ptr is a private variable if _DEBUG is not defined. In that case how to access the values inside the list? Thanks in advance.

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        What are you doing :confused: ? That's not the way to work with iterators. You hsould simply dereference them:

        int iCount = (*ittr)->iIdCount;

        Cédric Moonen Software developer
        Charting control [v1.4]

        A 1 Reply Last reply
        0
        • C Cedric Moonen

          What are you doing :confused: ? That's not the way to work with iterators. You hsould simply dereference them:

          int iCount = (*ittr)->iIdCount;

          Cédric Moonen Software developer
          Charting control [v1.4]

          A Offline
          A Offline
          Aryan S
          wrote on last edited by
          #4

          Thanks!!! I am actually new in this field... :(

          C 1 Reply Last reply
          0
          • A Aryan S

            Thanks!!! I am actually new in this field... :(

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            Aryan S wrote:

            I am actually new in this field... :(

            There are a lot of tutorials on the web, it would be much more efficient to read some of them before going any further developing code with tools that you don't how to use. Check this[^] for instance.

            Cédric Moonen Software developer
            Charting control [v1.4]

            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