📄 cppvector.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta name="generator" content="HTML Tidy for Linux/x86 (vers 1st October 2002), see www.w3.org"> <title>C++ Vectors</title> </head> <body bgcolor="#ffffff"> <table width="100%" bgcolor="#eeeeff"> <tr> <td><a href="index.html">cppreference.com</a> -> C++ Vectors</td> </tr> </table> <h3>C++ Vectors</h3> <p>Vectors contain contiguous elements stored as an array. Accessing members of a vector or appending elements can be done in <a href="complexity.html">constant time</a>, whereas locating a specific value or inserting elements into the vector takes <a href="complexity.html">linear time</a>.</p> <table> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#Constructors">Constructors</a></td> <td>methods to create vectors</td> </tr> <tr> <td><a href="cppvector_details.html#Operators">Operators</a></td> <td>assign and compare vectors</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#assign">assign()</a></td> <td>assign elements to the vector</td> </tr> <tr> <td><a href="cppvector_details.html#at">at()</a></td> <td>returns an element at a specific location</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#back">back()</a></td> <td>returns the last element</td> </tr> <tr> <td><a href="cppvector_details.html#begin">begin()</a></td> <td>returns an iterator to the first element</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#capacity">capacity()</a></td> <td>the number of elements the vector can hold</td> </tr> <tr> <td><a href="cppvector_details.html#clear">clear()</a></td> <td>removes all elements</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#empty">empty()</a></td> <td>true if the vector is empty</td> </tr> <tr> <td><a href="cppvector_details.html#end">end()</a></td> <td>returns an iterator to the last element</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#erase">erase()</a></td> <td>removes elements</td> </tr> <tr> <td><a href="cppvector_details.html#front">front()</a></td> <td>returns the first element</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#get_allocator">get_allocator()</a></td> <td>returns the vector's allocator</td> </tr> <tr> <td><a href="cppvector_details.html#insert">insert()</a></td> <td>insert elements into the vector</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#max_size">max_size()</a></td> <td>returns the maximum number of elements that the vector can hold</td> </tr> <tr> <td><a href="cppvector_details.html#pop_back">pop_back()</a></td> <td>removes the last element</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#push_back">push_back()</a></td> <td>adds an element to the end of the vector</td> </tr> <tr> <td><a href="cppvector_details.html#rbegin">rbegin()</a></td> <td>returns a reverse iterator to the end of the vector</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#rend">rend()</a></td> <td>returns a reverse iterator to the beginning of the vector</td> </tr> <tr> <td><a href="cppvector_details.html#reserve">reserve()</a></td> <td>sets the minimum capacity of the vector</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#resize">resize()</a></td> <td>change the size of the vector</td> </tr> <tr> <td><a href="cppvector_details.html#size">size()</a></td> <td>returns the size of the vector</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppvector_details.html#swap">swap()</a></td> <td>exchange two vectors</td> </tr> </table> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -