December 16th, 2008, 03:22 AM
for( li = x.lc.begin(); li != x.lc.end(); li++ )
gives the error below:
expected primary-expression before '.' token
December 16th, 2008, 03:26 AM
x is a type, not an object. That's what the "typedef" means.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
December 16th, 2008, 03:46 AM
what if I do this?
list<obj> lc; // STL
how do I put values in my elements and access each element using an iterator? I'm thinking to start,
lc.push_back(???) // for each element?
for( li = lc.begin(); li != lc.end(); li++ )
December 16th, 2008, 05:34 AM
list<x> lc; // STL
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
December 16th, 2008, 12:48 PM
now how do I access individual elements?
December 16th, 2008, 12:52 PM
You seem to have that down already with the for loop and the iterator.....
December 17th, 2008, 12:47 AM
Originally Posted by mikeleblanc666
Please use code tags.
, make an effort yourself, try googling
or search here
, give a proper description of your problem, include code* and error messages.
*All code should include code tags
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!