I have a vector of objects that I have to populate, and each object in the vector takes a certain amount of time to be built. The amount isn't significant for less than 100 objects, but after a while, it starts to take a very long time to populate the entire vector. I need to be able to build the vector fast for 1000 or more objects.
Does anyone know of a standard C++ way I could speed things up, rather than just using a simple for loop like this?
vector<MyObject> myVector;
for( int i = 1; i <= numObjects; i++ ) {
MyObject* object = new MyObject();
object->build( i );
myVector.push_back( *object );
}
I haven't been able to find a standard multithreading solution, and I'm not quite sure what to make of POSIX; is that reliable across systems?
I'd appreciate any insight or advice on this.
Thanks,
Zel2008

New Topic/Question
Reply




MultiQuote




|