STL容器

list

插入:Does not affect the validity of iterators and references. If an exception is thrown there are no effects.

插入复杂度:Insertion of a single element into a list takes constant time and exactly one call to the copy constructor of T. Insertion of multiple elements into a list is linear in the number of elements inserted, and the number of calls to the copy constructor of T is exactly equal to the number of elements inserted.

删除:Invalidates only the iterators and references to the erased elements.

删除复杂度:Erasing a single element is a constant time operation with a single call to the destructor of T.

Erasing a range in a list is linear time in the size of the range and the number of calls to the destructor of type T is exactly equal to the size of the range.

deque

插入:An insert in the middle of the deque invalidates all the iterators and references to elements of the deque. An insert at either end of the deque invalidates all the iterators to the deque, but has no effect on the validity of references to elements of the deque.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Times}

插入复杂度:In the worst case, inserting a single element into a deque takes time linear in the minimum of the distance from the insertion point to the beginning of the deque and the distance from the insertion point to the end of the deque. Inserting a single element either at the beginning or end of a deque always takes constant time and causes a single call to the copy constructor of T.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Times} span.s1 {font: 10.0px Courier}

删除:An erase in the middle of the deque invalidates all the iterators and references to elements of the deque. An erase at either end of the deque invalidates only the iterators and the references to the erased elements.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Times}

删除复杂度:The number of calls to the destructor is the same as the number of elements erased, but the number of the calls to the assignment operator is at most equal to the minimum of the number of ele- ments before the erased elements and the number of elements after the erased elements.

关联容器

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Times}

The insert members shall not affect the validity of iterators and references to the container, and the erase members shall invalidate only iterators and references to the erased elements.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Times}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值