#include <bits/stdc++.h> using namespace std; int main(){ int x[] = {2,3,4,5,6,7}; deque<int> a(x,x+sizeof(x)/sizeof(int)); cout<<"初始值:"; for(int i = 0;i<a.size();i++){ cout<<a[i]<<" "; } cout<<endl; a.push_front(1); cout<<"二次值:"; for(int i = 0;i<a.size();i++){ cout<<a[i]<<" "; } cout<<endl; a.pop_front(); cout<<"三次值:"; for(int i = 0;i<a.size();i++){ cout<<a[i]<<" "; } cout<<endl; cout<<"第一个元素:"<<a.front()<<endl; cout<<"最后一个元素:"<<a.back(); return 0; }
标签:特有,deque,函数,事例,int,sizeof From: https://www.cnblogs.com/wangyihang-xh/p/17937202