本文介紹了STL 中的向量與列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我在 Effective STL 中注意到
I noticed in Effective STL that
vector 是序列的類型應(yīng)該默認(rèn)使用.
vector is the type of sequence that should be used by default.
什么意思?似乎忽略效率vector
可以做任何事情.
What's does it mean? It seems that ignore the efficiency vector
can do anything.
誰能給我一個場景,其中 vector
不是一個可行的選擇,但必須使用 list
?
Could anybody offer me a scenario where vector
is not a feasible option but list
must be used?
推薦答案
您想在除序列末尾以外的任何地方重復(fù)插入大量項目的情況.
Situations where you want to insert a lot of items into anywhere but the end of a sequence repeatedly.
查看每種不同類型容器的復(fù)雜性保證:
Check out the complexity guarantees for each different type of container:
標(biāo)準(zhǔn)容器的復(fù)雜性保證是什么?
這篇關(guān)于STL 中的向量與列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!