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. List assertation failure

List assertation failure

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

    Hi I have the following

    struct tcbholder
    {
    char* tcb;
    char programname[8];
    // struct stdecs *storageptr;
    struct stdecs stdecsx;
    list strptr;
    list ::iterator stfirstptr;
    list ::iterator straverse;
    };

    struct stdecs
    {
    struct vsmdesc stordesc;
    char* tcb;
    struct blkdesc ablkdescx;
    struct blkdesc fblkdescx;
    // struct stdecs* nextdecs;

    	list  ablkptr;
    	list::iterator blktraverse;
    	list fblkptr;
    }
    

    struct blkdesc
    {
    char type;
    int blkaddr;
    int blklen;
    // struct blkdesc* nextblkdesc;
    };

    I declare a list class

    list tcbcollecter;

    then a iterator

    list ::iterator tcbitrate;

    I am able to initialize the main iterator

    tcbitrate = tcbcollecter.begin();

    However when I try

    tcbitrate->straverse = tcbitrate->strptr.begin();

    I get the following

    _STL_VERIFY(this->_Ptr != _Mycont->_Myhead, "cannot dereference end list iterator");

    its in the list member line 151 Dont Understand Thanks

    G C 2 Replies Last reply
    0
    • F ForNow

      Hi I have the following

      struct tcbholder
      {
      char* tcb;
      char programname[8];
      // struct stdecs *storageptr;
      struct stdecs stdecsx;
      list strptr;
      list ::iterator stfirstptr;
      list ::iterator straverse;
      };

      struct stdecs
      {
      struct vsmdesc stordesc;
      char* tcb;
      struct blkdesc ablkdescx;
      struct blkdesc fblkdescx;
      // struct stdecs* nextdecs;

      	list  ablkptr;
      	list::iterator blktraverse;
      	list fblkptr;
      }
      

      struct blkdesc
      {
      char type;
      int blkaddr;
      int blklen;
      // struct blkdesc* nextblkdesc;
      };

      I declare a list class

      list tcbcollecter;

      then a iterator

      list ::iterator tcbitrate;

      I am able to initialize the main iterator

      tcbitrate = tcbcollecter.begin();

      However when I try

      tcbitrate->straverse = tcbitrate->strptr.begin();

      I get the following

      _STL_VERIFY(this->_Ptr != _Mycont->_Myhead, "cannot dereference end list iterator");

      its in the list member line 151 Dont Understand Thanks

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      It means that your "tcbcollecter" list was empty when you assigned the "tcbitrate" iterator. Calling begin() on an empty list will give you the end() iterator, because there is no real element to point to. You can't dereference it because it doesn't point at anything.

      F 1 Reply Last reply
      0
      • F ForNow

        Hi I have the following

        struct tcbholder
        {
        char* tcb;
        char programname[8];
        // struct stdecs *storageptr;
        struct stdecs stdecsx;
        list strptr;
        list ::iterator stfirstptr;
        list ::iterator straverse;
        };

        struct stdecs
        {
        struct vsmdesc stordesc;
        char* tcb;
        struct blkdesc ablkdescx;
        struct blkdesc fblkdescx;
        // struct stdecs* nextdecs;

        	list  ablkptr;
        	list::iterator blktraverse;
        	list fblkptr;
        }
        

        struct blkdesc
        {
        char type;
        int blkaddr;
        int blklen;
        // struct blkdesc* nextblkdesc;
        };

        I declare a list class

        list tcbcollecter;

        then a iterator

        list ::iterator tcbitrate;

        I am able to initialize the main iterator

        tcbitrate = tcbcollecter.begin();

        However when I try

        tcbitrate->straverse = tcbitrate->strptr.begin();

        I get the following

        _STL_VERIFY(this->_Ptr != _Mycont->_Myhead, "cannot dereference end list iterator");

        its in the list member line 151 Dont Understand Thanks

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        Quote:

        tcbitrate = tcbcollecter.begin();

        Quote:

        tcbitrate->straverse = tcbitrate->strptr.begin();

        If tcbcollecter is empty then the complaint is correct.

        "In testa che avete, Signor di Ceprano?" -- Rigoletto

        F 1 Reply Last reply
        0
        • G Graham Breach

          It means that your "tcbcollecter" list was empty when you assigned the "tcbitrate" iterator. Calling begin() on an empty list will give you the end() iterator, because there is no real element to point to. You can't dereference it because it doesn't point at anything.

          F Offline
          F Offline
          ForNow
          wrote on last edited by
          #4

          How would I solve this problem would calling tcbitrate->push_back solve it after that there is something on the list though the members of tcbcollector have not been assigned values

          G 1 Reply Last reply
          0
          • F ForNow

            How would I solve this problem would calling tcbitrate->push_back solve it after that there is something on the list though the members of tcbcollector have not been assigned values

            G Offline
            G Offline
            Graham Breach
            wrote on last edited by
            #5

            Instead of trying to manipulate the contents of these structs from outside I would add member functions to do it.

            F 1 Reply Last reply
            0
            • C CPallini

              Quote:

              tcbitrate = tcbcollecter.begin();

              Quote:

              tcbitrate->straverse = tcbitrate->strptr.begin();

              If tcbcollecter is empty then the complaint is correct.

              "In testa che avete, Signor di Ceprano?" -- Rigoletto

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #6

              I think I finally got it a iterator is for traversing I first have to populate the list I’m in bed now with my iPhone I’ll try this again after work Thanks

              1 Reply Last reply
              0
              • G Graham Breach

                Instead of trying to manipulate the contents of these structs from outside I would add member functions to do it.

                F Offline
                F Offline
                ForNow
                wrote on last edited by
                #7

                Was thinking how to that don’t know if it’s practical my list represents the output of VSMLIST z/os assembler mainframe macro representing the amount allocate free and I unallocated storage for an address space It’s listed by storage blocks ( address and length ) storage descriptors representing a storage subpool which different attributes and storage keys and the TCB task control blocks of the task that own them

                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