c++ - Is there any performance penalty for using std::stack rather than the underlying std::deque?
问题描述
I want to implement a LIFO stack object. The C++ standard lib provides a convenient stack structure (std::stack) with a very simple interface. By default, it uses std::deque as its underlying container.
Is there any performance penalty to using std::stack rather than using std::deque directly?
My use case would involve many pops and pushes per second.
解决方案
No, there will be no performance profile changes by using std::stack
(as compared to using std::deque
directly).
推荐阅读
- select - SQLite 中奇怪的“滥用聚合:max()”错误
- java - 无法解决方法 makeText(匿名 Android.view.View.OnclickListener,java.land.string , int)
- c# - List.IndexOf 在列表视图中删除项目后返回 -1
- java - 为什么我的数组得到排序?
- java - Spring Boot 连接到 localhost 数据库
- javascript - 在Angular 5中将带有geojson图层的传单地图导出为png
- javascript - If 和 Return 语句的问题
- php - PHP计算直到指定日期的天数加上直到一周中的指定日期的天数
- php - PHP Simple Dom Parser - 从 SPAN 中获取价值
- vba - VBA:搜索包