I am trying to populate a vector of string type and the memory for the strings will be updated periodically.I found out in a forum that, both of these processes consume a lot of time due to memory reallocation every time I update the size and I also read that the reserve function solves the problem pretty much for both the cases. -> String & vector
My vector wont need more than 1024 slots and each string will need 10 character spaces. I have reserved 1024 memory slots for my vector.
vector<string> power_set;
power_set.reserve(1024);
But is there any way to reserve the memory-slots for the strings that are inside the vector slots as well?
Thanks In Advance.