What are Containers/Adapters? C++(什么是容器/适配器?C++)
问题描述
什么是容器/适配器?我对 C++ 及其子主题(如(类/模板/STL)有基本的了解.
What are containers/adapters? I have basic knowledge of C++ and its sub-topics like (class/templates/STL).
谁能用通俗的语言解释一下,给我一个容器/适配器应用的实际例子?
Can anyone please explain in layman's language and give me a practical example of the application of containers/adapters?
推荐答案
C++ 技术性强,难懂 :-D</joke>
<joke>
C++ is technical and hard to understand :-D</joke>
容器是来自 STL 的数据类型,可以包含数据.
Containers are data types from STL that can contain data.
示例:vector
作为动态数组
适配器是来自 STL 的数据类型,用于适应容器以提供特定接口.
Adapters are data types from STL that adapt a container to provide specific interface.
示例:stack
在所选容器的顶部提供堆栈接口
Example: stack
providing stack interface on top of the chosen container
(旁注:两者实际上都是模板而不是数据类型,但这样的定义看起来更好)
(side note: both are actually templates not data types, but the definition looks better this way)
这篇关于什么是容器/适配器?C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:什么是容器/适配器?C++


- 如何对自定义类的向量使用std::find()? 2022-11-07
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 近似搜索的工作原理 2021-01-01
- 从python回调到c++的选项 2022-11-16
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 静态初始化顺序失败 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- C++ 协变模板 2021-01-01