Hi I'm trying to do this (and it seem works):
I I understand fine, this is a vector of Light with only one element(a pointer) that point to an array of 10 Light. Is it this?Code:
std::vector<Light*> light; // it's a vector of pointer to Light Light* l; l = new Light[10]; light.push_back(l); delete [] l; //delete is necessary
Otherwise:
Here I've a vecotr of 10 elements (pointer) that each one point to a Light;Code:
std::vector<Light*> light; // it's a vector of pointer to Light Light* l; l = new Light; for (int i=0; < 10< i++) light.push_back(l); delete [] l; //delete is necessary
I prefer the last....Code:
std::vector<Light> light; for (int i=0; <10; i++) light.push_back(Light());
Wich is better? Thanks