当前位置:网站首页>STL application (unfinished
STL application (unfinished
2022-06-11 19:33:00 【*c.】
Catalog
Container general functions :
.size() The number of elements in the container
.empty() Judge whether the container is empty Return to one bool value (true/fault)
.front() Returns the first element of the container
.back() Returns the last element of the container
.begin() Pointer to the first element of the container
.end() Pointer to the next position of the last element of the container
.swap(b) Exchange the contents of two containers
::iterator() iterator
An iterator is a generalized pointer , It could be a pointer , It can also be an object that performs a pointer like operation on it. You can use an iterator to output vector The elements in :
for(vector<int>::interator it=a.begin();it!=a.end();it++) cout<<*it<<endl;
vector( vector ) Basics :
Constructors :
a = vector(int) // Create an empty vector a,int type , The array name is a
a = vector(b) // copy constructor , Create a and b The same vector a Create a 2D array :vector<int>a[5] It's equivalent to creating 5 individual vector Each is an array
Additive elements :
a.push_back(x) // To vector a Add an element to the tail X
a.insert(it, x) // To vector a Iterators in it Add elements in front X
Remove elements :
a.pop_back() // Delete vector a The last element in
a.clear() // Empty vector a All elements in
a.erase(it) // Delete vector a Iterators in it Pointing elements
Get elements :
a.front() // Get vector a The head element of
a.back() // Get vector a The tail element of
Acquisition iterator
a.begin() // Get vector a Iterator for the head of
a.end() // Get vector a Iterator of tail
Get vector information
a.empty() // Judgment vector a Is it empty
a.size() // Judgment vector a Size
stack Basics
.stack<int>s Create a stack The type is int type
.push(x) x Push
.pop() Stack top exit
.top() Reference the top of the stack
.empty() Is the stack empty If it is empty, return to true
.size() Stack size Returns the number of elements in the stack
边栏推荐
- Flutter--Button浅谈
- 谷歌提出超强预训练模型CoCa,在ImageNet上微调Top-1准确率达91%!在多个下游任务上SOTA!...
- 【Laravel系列7.5】事件系统
- [untitled]
- 电子商务(njupt)
- 金字塔测试原理:写好单元测试的8个小技巧,一文总结
- On the selection and design of management subsystem of collection system
- 【求助】請問如何讓微信公眾號文章在外部瀏覽器中打開後還能顯示下方的精選留言?
- Pyqt5 tips - button vertical display method, QT designer sets button vertical display.
- cocan yocto buildroot
猜你喜欢

【视频去噪】基于SALT实现视频去噪附Matlab代码

Find the maximum 3 same digits in the string

Flash ckeditor rich text compiler can upload and echo images of articles and solve the problem of path errors

Software requirements engineering review

Experience of remote office communication under epidemic situation | community essay solicitation
![[assembly] analysis of Experiment 7 of the fourth edition of assembly language](/img/ac/a3c5bfeb2dcb93b123dd337993bab3.jpg)
[assembly] analysis of Experiment 7 of the fourth edition of assembly language

highcharts设置柱状图宽度、渐变、圆角、柱子上方数据

Hyper parameter optimization of deep neural networks using Bayesian Optimization

5g communication test manual based on Ti am5728 + artix-7 FPGA development board (dsp+arm)

【信号去噪】基于FFT和FIR实现信号去噪附matlab代码
随机推荐
Pstack and dmesg
5g communication test manual based on Ti am5728 + artix-7 FPGA development board (dsp+arm)
Longest strictly increasing subsequence
Picture bed: picgo+ Tencent cloud +typera
【高精度】X进制整数加法
[Lao Wang's fallacy of brain science] Why do blind people "seem" to be more "sensitive" than normal people?
Expandable type of system
MySQL federated index and BTREE
ASEMI的MOS管25N120在不同应用场景的表现
Crop disease detection using image processing technology and convolutional neural network (CNN)
Common - name of conference room
cocan yocto buildroot
Detailed explanation of iSCSI (IV) -- actual configuration of iSCSI server
2022 the latest software testing classic summarized by major manufacturers. After reading it, I'm not afraid I won't get an offer
highcharts设置柱状图宽度、渐变、圆角、柱子上方数据
30讲 线性代数第二讲 矩阵
On high availability architecture
AHB_Bus_Matrix_3x3 设计
WinCC flexible 2008项目移植到博途WinCC的具体方法
collect. stream(). Use of the collect() method