std :: vector< T> :: pop_back的形式规范 [英] Formal specification of std::vector<T>::pop_back

查看:182
本文介绍了std :: vector< T> :: pop_back的形式规范的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C ++标准(草案n3797),我找不到任何文档 pop_back ,因为它适用于 std :: vector ,仅用于 std :: list 。是真的丢了吗?

I'm looking in the C++ Standard (draft n3797), and I can't find any documentation of pop_back as it applies to std::vector, only for std::list. Is it really missing?

特别是我在寻找保证 pop_back 不会改变容量。还是有这样的保证吗? (我期望迭代器和对其他元素的引用将保持有效,但我不能找到那个保证,它不会限制删除最后一个元素的情况)

Specifically I was looking for the guarantee that pop_back doesn't change the capacity. Or is there such a guarantee at all? (I expect that iterators and references to other elements will remain valid, but I can't find that guarantee, and it wouldn't restrict the case of removing the last element, anyway)

推荐答案

不错过。在101§23.2.3的表格中,您可以看到向量存在 pop_back

No it doesn't missed. In a table in 101 §23.2.3, you can see pop_back exists for vector.


16 表101列出了为某些类型的序列容器而不是其他序列容器提供的操作。实施应为容器列中显示的所有容器类型提供这些操作,并以执行摊销的常量时间

16 Table 101 lists operations that are provided for some types of sequence containers but not others. An implementation shall provide these operations for all container types shown in the "container" column, and shall implement them so as to take amortized constant time.

>

第16段提到他们应该实施摊还的固定时间

Paragraph 16 mentioned they should implement to take amortized constant time.

这篇关于std :: vector< T> :: pop_back的形式规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆