We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello!
I have recently noticed that when you have a non empty std::vector it has a minimum capacity of 32 elements. No matter how big the elements are. So I was wondering if this can be set to a different value. On windows the vector capacity grows nicely from 1 onwards.
Example:
struct BigStruct { char k; int i[100]; }; void minSizeTest() { std::vector<int> vec(10, 1337); // vec.size() == 10, vec.capacity() == 32 std::vector<BigStruct> vBig(10); // same as above! 32*sizeof(BigStruct) is a lot for my microprocessor :) }