Creating a vector of objects

Im trying to create a vector of objects similar to an ArrayList in processing.

this is my code so far;

  
void testApp::update(){  
	for (int i = 0; i < numofparticles; i++) {  
		if (particles.size() > maxparticles){  
			break;  
		}  
		else {  
			particles.push_back(new particle(ofRandom(2,-2),ofRandom(2,-2)));  
		}  
							   
	}  
}  
  

But im getting an error,

no matching function for call to ‘std::vector<particle, std::allocator >::push_back(particle*)’

any help would be great,

thanks
joss

The vector is made of object or points to objects?

if the vector it´s from pointer to particles it have been declare like this:

  
vector<Particle*> particles;  

and you can add new element using:

  
Particle * p = new Particle(...bla bla);  
particles.push_back(p);  

Other wise if it´s just made of objects it;

vector particles;

  
Particle p = Particle(...bla ...bla);  
particles.push_back(p);  

Because the “new” it´s to create a new space on memori for a pointer. That´s why at the end of error message said: “push_back(particle*)”