Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: how to properly dereference STL list item

Reply
Thread Tools

Re: how to properly dereference STL list item

 
 
Jakob Bieling
Guest
Posts: n/a
 
      07-01-2003
"Danny Anderson" <(E-Mail Removed)> wrote in message
news(E-Mail Removed) m...
> Hola, C++ folk!
>
>
> I have a list of class objects, list<development> jobs.
>
> I previously didn't need the list after I went through it once, so I was
> cycling through the list like this:
>
> development d;
> while(!done)
> {
> d=job.front();
> .
> .
> .
> job.pop_front();
> isJobDone(); //bool function to set exit condition
> }
>
>
> Now, I want to expand this program, so I am using iterators:
>
> list<development>::iterator itr;
> for(itr=job.begin();itr!=job.end();++itr)
> {
> d= ????;
> .
> .
> .
> }
>
> What is the correct syntax to reach the values?



d = *itr;

Just like you dereference a pointer, you dereference the iterator, sort
of ;o)

hth
--
jb

(replace y with x if you want to reply by e-mail)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
properly delete item during "for item in..." Ratko Python 7 07-17-2008 07:56 PM
remove an item in a STL list Gunnar G C++ 9 02-09-2005 03:24 PM
Change style of a single row of the item list of datagrid, based on a field value of current item... QUASAR ASP .Net Datagrid Control 6 01-17-2004 07:46 PM
Re: how to properly dereference STL list item Howard C++ 0 07-01-2003 05:46 PM



Advertisments