I want to ask a question about vectors in C++. I am learning about vectors at the moment, so I want to ask about it.
Is this code more efficient
vector<int> numbers;
numbers.reserve(10);
for (int i = 0; i < 10; i++){
numbers.push_back(i + 1);
}
than this
vector<int> numbers;
for (int i = 0; i < 10; i++){
numbers.push_back(i + 1);
}
?