My program works fine with a small number of insertions to v. However, with a huge number of insertions my program stops working without telling me the reason... I guess that vectors might not grow after a certain size (im not sure)
1. What is the maximum size that a vector of vectors can grow?
2. I'm using Microsoft visual studio 2012, Is their anything I can do with the settings to increase the size of my vector? something beyond 1000000 rows?
A vector can fail to allocate memory at any time before the theoretical maximum capacity though. It depends on the system. Also, vectors reaching large sizes can take exceedingly large times to operate on if you use erase or something that doesn't have constant complexity.
Thank you... It was helpful... I have tried the code... the program executed until it reached 2G and then it gave me a run time error since I reached the maximum size... However, with my program when I have a huge number of insertions to the vector, the program just stops execution without giving me a run time error which means that the vector did not reach the limit yet... but what do you think the reason would be???
what would be the reason of a program stopping its execution without any runtime error after too many insertions and calculations on the vector? Note that the program works fine with few insertions to the vector...
Vector::insert has linear time complexity depending on how many elements there are after the position you're inserting at, and if the vector has to reallocate that's also got linear complexity up to the entire size of the vector. So it's likely your program isn't crashing it's just taking a really long time to execute.