D
D
DVoropaev2016-08-11 21:31:52
Programming
DVoropaev, 2016-08-11 21:31:52

How to reduce the memory reserved for a vector in c++?

...
vector<int> myvector(int);
myvector.reserve(1000) // зарезервируем место под 1000 элементов 
...
myvector.reserve(10) // все равно зарезервированно место под 1000 эллементов
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2016-08-11
@DVoropaev

c++11 - shrink_to_fit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question