3. Chapter 3 vector

1. With the array can not increase the problem size increases, and dynamically allocated array need to manually manage memory, so the vector into being.

2. The vector memory used from the dynamic storage area managed by the system dynamics.

3. General reference or constant reference should pass form, to avoid a large number of copy operations.

4. When the vector is able to predict the final length, the length should be specified directly, rather than using continuous push_back () operation, to avoid consumption of replication expansion performed.

Guess you like

Origin www.cnblogs.com/Hello-Nolan/p/12232757.html