Click here to Skip to main content
15,867,308 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder16-Jul-09 3:09
cofounderChris Maunder16-Jul-09 3:09 
PinnedHow to get an answer to your question PinPopular
Chris Maunder16-Jul-09 3:05
cofounderChris Maunder16-Jul-09 3:05 
QuestionAI Pin
Ted Snyders18-Nov-23 9:52
Ted Snyders18-Nov-23 9:52 
AnswerRe: AI Pin
RedDk18-Nov-23 14:44
RedDk18-Nov-23 14:44 
QuestionHelp with STL list::insert Pin
ForNow21-Sep-22 1:54
ForNow21-Sep-22 1:54 
Hi

I need a little guidance trying to insert a element my element is a structure here below are my data structures

so I define a structure of type tcbholder struct tcbholder tcbx;

I initialize the iterator member with the following code

C++
tcbx.straverse = tcbx.strptr.begin(); // storage discriptor pointer
	tcbx.stdecsx.blktraverse = tcbx.stdecsx.ablkptr.begin(); // begin block pointer



then to insert a blkdesc type I use the following code

C++
tcbx.stdecsx.ablkptr.insert(tcbx.stdecsx.blktraverse,tcbx.stdecsx.ablkdescx);


I then think I would have to bump up the postion of the iterator so I do the following

C++
tcbx.stdecsx.blktraverse++;


after which I get an exception that I went past the end

Any help would be appreciated

thanks

My first question is am I correct that in initalizing the iterator the code is call list::begin

and then to bump up the interator to get next postion its operator ++


C++
struct blkdesc
   {
       char type;
       int blkaddr;
       int blklen;
       //  struct blkdesc* nextblkdesc;
   };
   struct stdecs
   {
       struct vsmdesc stordesc;
       char* tcb;
       struct blkdesc ablkdescx;
       struct blkdesc fblkdescx;
       //  struct stdecs* nextdecs;

       list<blkdesc> ablkptr;
       list<blkdesc>::iterator blktraverse;
       list<blkdesc> fblkptr;
   };

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

AnswerRe: Help with STL list::insert Pin
Graham Breach21-Sep-22 21:40
Graham Breach21-Sep-22 21:40 
GeneralRe: Help with STL list::insert Pin
ForNow22-Sep-22 1:35
ForNow22-Sep-22 1:35 
GeneralRe: Help with STL list::insert Pin
Graham Breach22-Sep-22 3:40
Graham Breach22-Sep-22 3:40 
GeneralRe: Help with STL list::insert Pin
ForNow22-Sep-22 4:31
ForNow22-Sep-22 4:31 
GeneralRe: Help with STL list::insert Pin
Graham Breach22-Sep-22 4:59
Graham Breach22-Sep-22 4:59 
GeneralRe: Help with STL list::insert Pin
ForNow22-Sep-22 5:11
ForNow22-Sep-22 5:11 
AnswerRe: Help with STL list::insert Pin
Richard MacCutchan22-Sep-22 4:51
mveRichard MacCutchan22-Sep-22 4:51 
GeneralRe: Help with STL list::insert Pin
ForNow22-Sep-22 9:30
ForNow22-Sep-22 9:30 
GeneralRe: Help with STL list::insert Pin
Richard MacCutchan22-Sep-22 22:28
mveRichard MacCutchan22-Sep-22 22:28 
GeneralRe: Help with STL list::insert Pin
ForNow23-Sep-22 1:45
ForNow23-Sep-22 1:45 
GeneralRe: Help with STL list::insert Pin
Richard MacCutchan23-Sep-22 1:55
mveRichard MacCutchan23-Sep-22 1:55 
GeneralRe: Help with STL list::insert Pin
ForNow23-Sep-22 2:20
ForNow23-Sep-22 2:20 
GeneralRe: Help with STL list::insert Pin
Richard MacCutchan23-Sep-22 3:16
mveRichard MacCutchan23-Sep-22 3:16 
GeneralRe: Help with STL list::insert Pin
ForNow23-Sep-22 4:11
ForNow23-Sep-22 4:11 
GeneralRe: Help with STL list::insert Pin
Richard MacCutchan23-Sep-22 4:38
mveRichard MacCutchan23-Sep-22 4:38 
GeneralRe: Help with STL list::insert Pin
ForNow23-Sep-22 4:48
ForNow23-Sep-22 4:48 
QuestionMessage Closed Pin
19-Jul-22 5:14
Member 1496877119-Jul-22 5:14 
AnswerRe: error: cannot call member function ‘bool QRegExp::exactMatch(const QString&) const’ without object Pin
jsc4219-Jul-22 6:35
professionaljsc4219-Jul-22 6:35 
Question/std:c++20 broke a template class Pin
Member 1567106212-Jun-22 10:07
Member 1567106212-Jun-22 10:07 
AnswerRe: /std:c++20 broke a template class Pin
longjmp24-Nov-22 2:59
longjmp24-Nov-22 2:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.