![](/img/trans.png)
[英]Is every “vectors” of STL deque's implementation always has the same size?
[英]STL internals: deque implementation
deque被實現為向量向量(向量列表將阻礙恆定時間隨機訪問)。 輔助向量的大小取決於實現,常見的算法是使用以字節為單位的常量大小。
我的deque
實現,即GNU中的一個源自HP / SGI版本的實現,不是一個向量列表; 至少,不是std::vector
的std::list
。 評論說明
* In previous HP/SGI versions of deque, there was an extra template
* parameter so users could control the node size. This extension turned
* out to violate the C++ standard (it can be detected using template
* template parameters), and it was removed.
*
* Here's how a deque<Tp> manages memory. Each deque has 4 members:
*
* - Tp** _M_map
* - size_t _M_map_size
* - iterator _M_start, _M_finish
*
* map_size is at least 8. %map is an array of map_size
* pointers-to-"nodes". (The name %map has nothing to do with the
* std::map class, and "nodes" should not be confused with
* std::list's usage of "node".)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.