最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

STL内部:双端队列实施

SEO心得admin53浏览0评论
本文介绍了STL内部:双端队列实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 std :: deque 用于存储大量项目.我知道双端队列是作为向量列表实现的.这些向量的大小无法设置,但我徘徊了选择该大小的算法是什么.

I am using a std::deque for storing a large collection of items. I know that deques is implemented as a list of vectors. The size of those vectors cannot be set but I wander what is the algorithm for choosing that size.

推荐答案

deque被实现为向量的向量(向量列表将阻止恒定时间的随机访问).次要向量的大小取决于实现方式,一种常见的算法是使用恒定大小(以字节为单位).

deque is implemented as a vector of vectors (a list of vectors would impede the constant time random access). The size of the secondary vectors is implementation dependent, a common algorithm is to use a constant size in bytes.

发布评论

评论列表(0)

  1. 暂无评论