本 Wiki 开启了 HTTPS。但由于同 IP 的 Blog 也开启了 HTTPS,因此本站必须要支持 SNI 的浏览器才能浏览。为了兼容一部分浏览器,本站保留了 HTTP 作为兼容。如果您的浏览器支持 SNI,请尽量通过 HTTPS 访问本站,谢谢!
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
cs:programming:cpp:cpp_primer:9_containers [2024/12/14 13:04] – [使用 swap 函数赋值] codinghare | cs:programming:cpp:cpp_primer:9_containers [2024/12/14 13:07] (当前版本) – [顺序容器的特性] codinghare | ||
---|---|---|---|
行 16: | 行 16: | ||
* Deque 支持快速随机访问。添删首尾元素快,中间元素慢 | * Deque 支持快速随机访问。添删首尾元素快,中间元素慢 | ||
* Array 是新标准的容器,不支持添删和改变容器大小。相较于 Build-in Aarray 更安全 | * Array 是新标准的容器,不支持添删和改变容器大小。相较于 Build-in Aarray 更安全 | ||
- | + | {{ :cs:programming:cpp:cpp_primer: | |
- | < | + | |
<WRAP center round tip 100%> | <WRAP center round tip 100%> | ||
新标准下的 STL 容器比旧版本下的快上许多,在可以使用的地方尽可能的使用。 | 新标准下的 STL 容器比旧版本下的快上许多,在可以使用的地方尽可能的使用。 | ||
行 47: | 行 46: | ||
操作的详细分类如下表: | 操作的详细分类如下表: | ||
- | \\ \\ < | + | \\ \\ {{ :cs:programming:cpp:cpp_primer:container_operations.svg?600 |}} |
- | < | + | {{ :cs:programming:cpp:cpp_primer:define_init_containers_2.svg?600 |}} \\ \\ |
总的来说,**容器都是类模板**(// | 总的来说,**容器都是类模板**(// | ||
<code cpp> | <code cpp> | ||
行 192: | 行 191: | ||
===赋值与 swap=== | ===赋值与 swap=== | ||
容器的赋值分为三个类型的操作。具体操作可以参考下图: | 容器的赋值分为三个类型的操作。具体操作可以参考下图: | ||
- | \\ \\ < | + | \\ \\ {{ :cs:programming:cpp:cpp_primer:container_assginment_op.svg?600 |}} \\ \\ |
==使用 assign operator 赋值== | ==使用 assign operator 赋值== | ||
赋值操作符 '' | 赋值操作符 '' |