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++
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- CString 到 char* 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
