If I call edit : I will use the container again and again, because of performance reasons I want to avoid memory allocation. For this reason I keep the memory in front, so I want to be sure that nothing is done to lose allocated memory. Edit: Due to performance, I want to avoid memory allocation, so I use the container bar I will use it again. This is because I reserve the memory so I want to be sure that I do nothing to lose allocated memory. You only need to avoid two things: 1. , But this is only request for free memory, in fact it is not necessary for vector to do this. The ability to make only Neither vector nor vector capacity will be reduced by small size. Consider using BTW. std :: vector :: reserve then a certain quantity In memory vector, I will not delete my
vector , or any method call (maybe
clear ) will free my reserved memory, it will save the memory ?
swap with 2 empty vectors will change (see see):
vector < Int & gt; V; V.reserve (100); Of vector & lt; Int>. () Swap (v); Esrete (v.capacity () == 0);
No comments:
Post a Comment