reserve method of vector

G

George2

Hello everyone,


I read MSDN document about reserve method of vector, but I can not
find answers to the following 2 questions after reading it,

1. if we reserve 10,000 size, will the memory actually be occupied
10,000 size (like committed memory of Windows Virtual Memory
management) or the memory will just be reserved for future use (like
reserved memory of Windows Virtual Memory management);

2. Will reserve method of vector improve performance? If yes, could
anyone share some experiences please?

If reserve method has any additional benefits beyond performance,
please also let me know. :)


thanks in advance,
George
 
P

Philip Potter

George2 said:
Hello everyone,


I read MSDN document about reserve method of vector, but I can not
find answers to the following 2 questions after reading it,

1. if we reserve 10,000 size, will the memory actually be occupied
10,000 size (like committed memory of Windows Virtual Memory
management) or the memory will just be reserved for future use (like
reserved memory of Windows Virtual Memory management);

2. Will reserve method of vector improve performance? If yes, could
anyone share some experiences please?

If reserve method has any additional benefits beyond performance,
please also let me know. :)

That's not C. Try comp.lang.c++.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top