分配新块时,如何控制std :: deque的块大小? [英] How to control the chunk size of `std::deque` when allocating a new chunk?

查看:257
本文介绍了分配新块时,如何控制std :: deque的块大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在std::deque中插入新元素时,如果现有块都已满,它可能会分配一个新块来包含该元素.

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?

用户可以控制块大小吗?或者仅取决于实现的选择,例如4K或8K?

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?

推荐答案

这是实现的选定值,无法对其进行控制.

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

例如,Microsoft为块中的元素数量选择16或更小的值. (搜索_DEQUESIZ).

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

这篇关于分配新块时,如何控制std :: deque的块大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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