What is the paging effect in C ++?

I stumbled upon this as I was trying to learn array and vectors in C ++. What is the “paging effect” mentioned in the message? Also, to test my own understanding, I think the vector uses more time due to dynamic memory allocation. I'm right?


additional question: but with vector<int> arr( 10000 )whether there is already enough memory for 10000 int allocated? or put it this way, arrstill growing if everything I do iterates through each element and initializes them?

+3
source share
3 answers

, push_back(), reserve().

( ) , . , C.

, . , , . .

edit: () "C" STL . , STL, . , , "C", . STL, han.

+5

, , , . , - , , .

" ", , , . , / , , .

+1

array[size - 1] = 0;

, . - , . , , .

, , .

, ++.

, , : , - . C . , .

-1

Source: https://habr.com/ru/post/1720418/


All Articles