I know that I can iterate over a list of strings as follows:
list<string>::iterator Iterator;
for(Iterator = AllData.begin();
Iterator != AllData.end();
Iterator++)
{
cout << "\t" + *Iterator + "\n";
}
but how can I do something like this?
list<CollectedData>::iterator Iterator;
for(Iterator = AllData.begin();
Iterator != AllData.end();
Iterator++)
{
cout << "\t" + *Iterator.property1 + "\n";
cout << "\t" + *Iterator.property2 + "\n";
}
or if someone can explain how to do this with a loop for_each, this is also very useful, but it seemed more complicated from what I read.
Thank you very much
source
share