Here, I know that for a vector of a "primitive" type, we can initialize it using:
vector<int> myInts(100);
the vector will be initialized with a 100 spaces filled with zeros.
Now, I'm playing with a particle system using OpenGL and I want to do something like this:
std::vector<Particle> particles(1000);
but it won't compile. the type Particle is a class using the default constructors and destructors, and filled with hand-made, declared "default" variables. This class could be a struct by any means...
As it won't compile, I'm initializing the vector using
for(int i = 0; i < MAX_PARTICLES; i++){
Particle *particle = new Particle();
particles.push_back(*particle);
}
any help is welcomed!
cheers,
Fabio