implementation of Vector (using C++)
阿新 • • 發佈:2019-02-04
The Vector will be a first-class type,meaning that unlike the primitive array in C++,the Vector can be cpoied,and the memory it uses can be automatically reclaimed(via its destructor).
First,recall some important fetures of C++ primitive arrays:
(1):The array is simply a pointer variable to a block of memory;the autual array size must be
maintained separately by the programmer.
(2):The block of memory can be allocated via new[],but then must be free via delete[].
(3):The block of memory can not be resize
Now,outline the main details of Vector:
well,go to read the source code,it's very simple ^_^