什么是容器/适配器? C ++ [英] What are Containers/Adapters? C++
问题描述
容器/适配器是什么?
有人请以外行人的语言说明
Someone please explain in layman's language.
我试图在互联网上查找,但定义和解释太技术性,难以理解。
I have tried to look up on the internet but the definitions and explanations are too technical and hard to understand.
我有基本的
编辑1:
任何人都可以给我一个应用容器/适配器的实际例子吗?
Can anyone please give me a practical example of the application of containers/adapters?
只是为了更好地理解:-)
Just for better understanding :-)
谢谢。
推荐答案
< joke>
C ++技术难以理解: -D < / joke>
<joke>
C++ is technical and hard to understand :-D</joke>
容器是来自STL的可包含数据的数据类型。
Containers are data types from STL that can contain data.
示例:向量
作为动态数组
适配器是数据类型
例如: 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 ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!