people isn't an iterator, it's a vector. That code doesn't directly use iterators.
Printable View
The Person class describes a single person. The PersonVector is an alias for a vector of Person.Code:#include <vector>
#include <string>
class Person
{
int age;
int weight;
int gender;
int height_in_inches;
std::string name;
std::string country_of_birth;
//...
//.. add public members
};
typedef std::vector<Person> PersonVector;
int main()
{
PersonVector pV;
pV.push_back( Person() );
}
So what do you not understand about the code above? You should start with something more coherent such as the code above.
Regards,
Paul McKenzie
What's wrong is you're looking at things you don't understand and asking questions that don't make any sense. If you want to learn the language, and there's a very steep learning curve, get a good book that takes you through the basics in a well organized, methodical manner. You'll never learn C++ by looking at code and trying to guess what it does.
I'm sorry.
It was not my intention to be impolite or bumptious.
I just wondered what some people could tell me if I'd ask such questions.
I appreciate your criticism!
GCDEF, I agree with you.
I want to make headway by different approaches. And I'm really trying to code my own stuff.
Many thanks for the example, Paul McKenzie!
You were not impolite.
It's that the C++ language isn't something that can be learned informally without structure. Some try but then get tangled in all sorts of knots trying to write the simplest of programs.
Others try to write advanced programs (for example using templates), but are lacking in the basic C++ fundamentals required to write such code (the "cherry-pickers" suffer from this fate).
A good book or set of books should be used, so that you understand each concept before moving on to another concept.
Regards,
Paul McKenzie