With 12 entries, any speed decrease should not be due reallocation. To test this, construct the vector with the correct number of entries:
Code:
int blah() {
int x, TotalPlats;
SetPos(0, 0);
TotalPlats=12;
vector <Platform> Plat(TotalPlats);
for(x=0; x < TotalPlats; x++)
Plat[x] = FindPlatform();
}
or use reserve to allocate the space first:
Code:
int blah() {
int x, TotalPlats;
vector <Platform> Plat;
SetPos(0, 0);
TotalPlats=12;
Plat.reserve(TotalPlats);
for(x=0; x < TotalPlats; x++)
Plat.push_back(FindPlatform());
}
Note that using reserve will minimize the calls to the copy constructor. If Shakti is right that the Platform class's copy constructor does a lot of processing (even though the posted version of the class doesn't have a copy constructor defined), then using reserve will minimize that copying.