C++高性能并行编程与优化 - 课件 - 14 C++ 标准库系列课 - 你所不知道的 set 容器你所不知道的 set 容 器 by 小彭老师( @archibate ) 课件 & 代码: https://github.com/parallel101/course 上期回顾: https://www.bilibili.com/video/BV1qF411T7sd 课程安排 1. vector 容器初体验 & 迭代器入门 (BV1qF411T7sd) 2. 你所不知道的 set 容器 & ,内存管理与对象生命周期 set 和 vector 的区别 • 都是能存储一连串数据的容器 。 • 区别 1 : set 会自动给其中的 元素从小到大排序,而 vector 会保持插入时的顺序。 • 区别 2 : set 会把重复的元素 去除,只保留一个,即去重。 • 区别 3 : vector 中的元素在内 存中是连续的,可以高效地按 索引随机访问, set 则不行。 • 区别 4 4 : set 中的元素可以高 效地按值查找,而 vector 则 低效。 set 的排序: string 会按“字典序”来排 • set 会从小到大排序,对 int 来 说就是数值的大小比较。那么对 字符串类型 string 要怎么排序 呢? • 其实 string 类定义了运算符重 载 < ,他会按字典序比较两个 字符串。所谓字典序就是优先比 较两者第一个字符(按 ASCII 码比较),如果相等则继续比较0 码力 | 83 页 | 10.23 MB | 1 年前3
Many Ways to Kill an Orc (or a Hero)knowledge void attack(Character &from, Character &to) { from.hit(to); // <-- OOPS } void print_result(const Character &a, const Character &b) { std::print("{} won", a.alive() ? a.name() : b.name()); Character { /* ... */ }; // ... void attack(Character &from, Character &to) { /* ... */ } void print_result(const Character &a, const Character &b) { /* ... */ } int main() { // ... while(orc.alive() attack(hero, orc); // <-- OOPS else attack(orc, hero); // <-- OOPS } print_result(orc, hero); } 33What this is about? // ... class Hero : public Character { /* ... */ }; class0 码力 | 202 页 | 1.26 MB | 6 月前3
Conan 1.26 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 669 页 | 5.51 MB | 1 年前3
Conan 1.25 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 655 页 | 5.45 MB | 1 年前3
Conan 1.24 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 647 页 | 5.31 MB | 1 年前3
Conan 1.31 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 721 页 | 5.41 MB | 1 年前3
Conan 1.30 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 715 页 | 5.39 MB | 1 年前3
Conan 1.29 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 703 页 | 5.41 MB | 1 年前3
Conan 1.28 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 699 页 | 5.39 MB | 1 年前3
Conan 1.27 Documentationfree community edition of JFrog Artifactory for Conan packages, including a WebUI, multiple auth protocols (LDAP), Virtual and Remote repositories to create advanced topologies, a Rest API and generic repositories ConanCenter assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client. Conan needs Python the information for the build system: Important: If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following0 码力 | 681 页 | 5.55 MB | 1 年前3
共 354 条
- 1
- 2
- 3
- 4
- 5
- 6
- 36













