本文介绍了在C ++中,是std :: string :: push_back()O(1)的摊销复杂度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道标准指定它是向量,但是字符串呢?

I know the standard specifies that it is for vectors, but what about strings?

推荐答案

时间。请参阅第716页的表101 :

Yes, it is amortized constant time. See table 101 on page 716 of this document:



Operation      | Description          | Container
---------------+----------------------+----------------------------------
a.push_back(t) | Appends a copy of t. | basic_string, deque, list, vector

这篇关于在C ++中,是std :: string :: push_back()O(1)的摊销复杂度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 03:04