C + + vector usage

Source: Internet
Author: User
http://blog.csdn.net/hancunai0017/article/details/7032383

1.push_back add a data at the end of the array
2.pop_back remove the last data from the array
3.at data with numbered position
4.begin pointer to array header
5.end gets the pointer to the last cell +1 of the array
6. Front gets the reference to the array header
7.back gets the reference to the last cell of the array
8.max_size get the vector max can be how big
9.capacity the size of the current vector allocation
10.size the current size of the data used
11.resize change the size of the current usage data, if it is larger than the current use, fill the default value
12.reserve change the size of the current VECOTR allocated space
13.erase Delete the data item that the pointer points to
14.clear empty the current vector
15.rbegin returns the start pointer after the vector reversal (actually the original end-1)
16.rend returns the end pointer of the vector inversion (actually the original begin-1)
17.empty determines whether the vector is empty
18.swap exchanging data with another vector

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.