Home > Back-end >  The use of the C of the resize
The use of the C of the resize

Time:10-11

Can say specific point? Such as x.r esize (n, 0); What do you mean?

CodePudding user response:

This,,, don't know the , the Google, find a little thing, lz may look to yourself useful not
- http://bbs.chinaunix.net/thread-3731866-1-1.html
- http://blog.csdn.net/shuchao/article/details/3713219

CodePudding user response:

The
refer to the original poster u013981999 response:
can say specific point? Such as x.r esize (n, 0); What do you mean?


The value of The new elements added to The vector if The new size is larger that The The original size. If The value is omitted, The new objects are assigned to The default value.
Mean to adjust the size x, and increase the elements of the assignment of 0.

CodePudding user response:

The resize (), set the size (size); Reserve (), set up the capacity (capacity); The size () is a container allocated memory size, and capacity () just set the container size, but there is no real memory, for example, is building a bus, the bus can be set inside the 40 seats (reserve (40);) , this is its capacity, but is not to say that it had 40 seats, can explain the car interior space can be put under 40 seats, 40 seats installed inside the car (the resize (40);) Inside the car at this time, really have 40 seats, these seats can be used
  • Related