Standard Template Library

Can any one help me with this:
The simplest way of declaring a vector of integers is as the following:

std::vector<int> bob;

in which int is the type of the elements and bob is the name of the vector.

But in the following code,1. I don't understand what is the <EventGenerator*> ??

2. are push_back() and TwoBodyGenerator() two functions??

3. what does this line do?
std::vector<Particle*> particles = gen1->generate( pz );
---------------------------------------------------------------
std::vector<EventGenerator*> generators;
generators.push_back( new TwoBodyGenerator("B0", "K+", "pi-") );
generators.push_back( new ThreeBodyGenerator("D-", "K+", "pi-", "pi-") );
for ( iter = generators.begin(); iter != generators.end(); ++iter ) {
std::vector<Particle*> particles = gen1->generate( pz );
----------------------------------------------------------------

Thank you in advance for your help
In the first line, generators is a vector whose elements are pointers to EventGenerators.
In the second and the third a TwoBodyGenerator and a ThreeBodyGenerator are constructed and memory is allocated using new. They are both pushed back [http://cplusplus.com/reference/stl/vector/push_back] to the vector.
In the last line the = operator is used to copy vector's content into another one.

More about vectors: http://cplusplus.com/reference/stl/vector/
[Assuming you are familiar with the classes used there (like TwoBodyGenerator, EventGenerator, etc.), those aren't standard...]
1. Like in your example with int, EverntGenerator* is the type stored in vector.
2. TwoBodyGenerator is a constructor.
3. That line uses a pointer gen1 to call a method generate, passes pz to that method and assigns its returned value to a vector of Particle*.

If you don't understand pointers, dynamic memory or classes, you'll find them explained here: http://www.cplusplus.com/doc/tutorial/

Also, http://www.cplusplus.com/forum/articles/42672/
Topic archived. No new replies allowed.