C++ 中list、vector和deque比较[转]

转自 http://blog.csdn.net/xiaolajiao8787/article/details/5882609

类型

Vector

Deque

List

内存管理

Poor

Good

perfect

使用[ ]和at() 操作访问数据

Very good

Normal

N/A

Iterator的访问速度

Good

Very good

Good

Push_back操作(后插入)

Good

Good

Good

Push_front操作(前插入)

N/A

Very good

Good

Insert(中间插入)

Poor

Perfect

Perfect

Erase(中间删除)

Poor

Perfect

Perfect

Pop_back(后部删除)

Perfect

Perfect

Normal

Swap(交换数据)

Perfect

Very good

Good

遍历

Perfect

Good

Normal

原文地址:https://www.cnblogs.com/howeho/p/4249890.html