How to control the chunk size of `std::deque` when allocating a new chunk?

有些话、适合烂在心里 提交于 2019-12-01 01:55:02

问题


When we insert a new element into a std::deque, it may allocate a new chunk to contain the element if the existing chunks are all full.

However, how does the implementation control the chunk size?

Is it possible for the user to control the chunk size? or it just depends on the implementation's choice, e.g. 4K or 8K?


回答1:


This is a chosen value of the implementation, and there is no control over it.

For example Microsoft choose values of 16 or smaller for the number of elements in a block. (Search for _DEQUESIZ).



来源:https://stackoverflow.com/questions/24482767/how-to-control-the-chunk-size-of-stddeque-when-allocating-a-new-chunk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!