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++
基础教程推荐
- 随机插入/删除的综合向量与链表基准 2022-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- c++ STL设置差异 2022-01-01
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
