linux下練習 c 容器的deque的特性

2021-06-10 07:58:09 字數 709 閱讀 4825

/*

deque特性

下標:.operator(i)不檢查越界,.at(i)

刪除:.pop_front(),.pop_back()

*/#includeusing namespace std;

#include#include "print.h"

int main()

{ dequedq;

dq.push_back('c');

dq.push_back('d');

dq.push_back('e');

dq.push_back('f');

print(dq.begin(),dq.end());

dq[1]='t';//把 d 改為 t

for(int i=0;i

#include using namespace std;

#ifndef print_fun

#define print_fun

template///顯示序列資料

linux下練習 c 容器的vector的特性

vector的特性 當前容量 capacity 約定容量 reserve 下標 operator i at i 越界丟擲異常 includeusing namespace std include include include include print.h void print const vec...

C 容器vector 語法練習

程式設計不是什麼技術活,就是個手工活,常常練習,否則手很生.前面寫個一次,很久不用就忘記了.cpp view plain copy c prime 習題3.17 p31 熟悉下容器操練語法 include include using namespace std void main if ivec.s...

Linux下C程式設計2 執行緒的練習

先挖坑,週末再補 對於多執行緒的demo,主要在嘗試封裝 thread類來簡化建立多執行緒的步驟 主要參考文章 跳轉1 執行緒基類 basethread 主要提供介面 自己的功能執行緒類 mythread 主要去實現你的執行緒中希望執行的操作 ifndef cthread hh define cth...