C++高性能并行编程与优化 - 课件 - 17 由浅入深学习 map 容器由浅入深学习 map 容器 by 彭于斌( @archibate ) 我负责监督你鞋习 ! 我负责监督你鞋习 ! 本期看点: 用方括号 [ ] 取出 map 元素居然是错误的! 能不能在遍历的同时删除元素?安全吗? emplace , emplace_hint , try_emplace 的区别? 课程安排 1. vector 容器初体验 & 迭代器入门 (BV1qF411T7sd) 2 set 容器 & 迭代器分类 (BV1m34y157wb) 3. string , string_view , const char * 的爱恨纠葛 (BV1ja411M7Di) 4. 万能的 map 容器全家桶及其妙用举例 ( 本期 ) 5. 函子 functor 与 lambda 表达式知多少 6. 通过实战案例来学习 STL 算法库 7. C++ 标准输入输出流 & 字符串格式化 8. traits 第一章:读取与写入 我负责监督你鞋习 ! 我负责监督你鞋习 ! map 查找元素的两个接口 • map 提供了两个查找元素的接口,一曰 [] ,二曰 at 。 • 那么他们两个又有什么区别呢?很多新手都分不清他俩,可能只认识 [] 。 读取 map 元素 • mapm; • 读取 map 中指定键值的元素有两种方法。 • val = m[“key”]; 0 码力 | 90 页 | 8.76 MB | 1 年前3
JAVA 应用与开发 - 集合与映射4, 2019 ���� �����List����Set�����Map�的������� ���������� ������iterator��Enumeration ��������� API ������的������������ 1 28 �� 1 ������� 2 Collection � Map �� 3 �� 4 Iterator �� 5 � 6 �� ��������的������������� ������������的��� �� List ������的��������������� ������的���������������� �������� �� Map �����的��¡���Key-Value������ �������的��������������� 注意 Java 集合中只能保存引用类型的数据,实际上存放的是对象的引用 而非对象本身。Java ��������的������������� ������������的��� �� List ������的��������������� ������的���������������� �������� �� Map �����的��¡���Key-Value������ �������的��������������� 注意 Java 集合中只能保存引用类型的数据,实际上存放的是对象的引用 而非对象本身。Java0 码力 | 66 页 | 713.79 KB | 1 年前3
Leveraging a Functional Approach for More Testable and Maintainable ROS 2 Codeits environment ● Enter: The occupancy map ○ A data structure used to represent the environment around a robot in terms of how “occupied” the cells in the map are Clip from https://www.youtube.com/watch occupancy map ○ A data structure used to represent the environment around a robot in terms of how “occupied” the cells in the map are ● Assumption: The robot knows its location in the occupancy map at all occupancy map ○ A data structure used to represent the environment around a robot in terms of how “occupied” the cells in the map are ● Assumption: The robot knows its location in the occupancy map at all0 码力 | 200 页 | 1.77 MB | 6 月前3
CppCon 2021: Persistent Data StructuresIntroduction Persistent Hash Map Persistent Transactional Data Structures Live Demonstration ReferencesIntroduction Persistent Hash Map Persistent Transactional Data Structures Live Demonstration References References Overview Introduction Persistent Memory Use-Cases Pitfalls Persistent Hash Map Design Goals and Methodology Persistence Performance Results Persistent Transactional Data Structures Design Demonstration A Persistent Hash Map for Graph Processing Workloads and a Methodology for Persistent Transactional Data Structures 2IntroductionIntroduction Persistent Hash Map Persistent Transactional Data0 码力 | 56 页 | 1.90 MB | 6 月前3
Cache-Friendly Design in Robot Path Planningenvironment This is a map of a make-believe distribution facility that is: 0.8 km long 0.4 km deep 51The operating environment This is a spatial graph extracted from the map. 52The operating environment std::for_each #include <map> // std::map, std::multimap #include// std::apply class Graph { private: std::multimap adjacencies_; std::map std::for_each #include <map> // std::map, std::multimap #include // std::apply class Graph { private: std::multimap adjacencies_; std::map 0 码力 | 216 页 | 10.68 MB | 6 月前3
Go 101 (Golang 101) v1.21.0on CSP model) and select mechanisms to do synchronizations between goroutines. the container types map and slice are first-class citizens. polymorphism through interfaces. value boxing and reflection through only 25 keywords: break default func interface select case defer go map struct chan else goto package switch const fallthrough if range package, type and var are used to declare all kinds of code elements in Go programs. chan, interface, map and struct are used as parts in some composite type denotations. break, case, continue, default, else0 码力 | 610 页 | 945.17 KB | 1 年前3
The Way To Go - 2012.........................185 8.1.2 Map capacity .............................................................................................188 8.1.3 Slices as map values ............................ .................................................188 8.2 Testing if a key-value item exists in a map—Deleting an element ..........................188 8.3 The for range construct .................... ................191 8.5 Sorting a map ........................................................................................................192 8.6 Inverting a map ..................................0 码力 | 629 页 | 4.85 MB | 1 年前3
Go 101 (Golang 101) v1.21.0on CSP model) and select mechanisms to do synchronizations between goroutines. the container types map and slice are first-class citizens. polymorphism through interfaces. value boxing and reflection through 25 keywords: 1| break default func interface select 2| case defer go map struct 3| chan else goto package switch 4| const fallthrough if package, type and var are used to declare all kinds of code elements in Go programs. chan, interface, map and struct are used as parts in some composite type denotations. break, case, continue, default,0 码力 | 880 页 | 833.34 KB | 1 年前3
MoonBit月兔编程语言 现代编程思想 第十课 哈希表与闭包
添加/更新操作 1. fn put[K : Hash + Eq, V](map : HT_bucket[K, V], key : K, value : V) -> Unit { 2. let index = key.hash().mod_u(map.length) // 计算对应索引 3. let mut bucket = map.values[index] // 找到对应数据结构 4. while => { // 如果没有找到,添加并退出循环 7. bucket.val = Some({ key, value }, { val: None }) 8. map.size = map.size + 1 9. break 10. } 11. Some(entry, rest) => { 12. if entry else { // 否则,将bucket替换为更⼩的结构,保证循环会终结 16. bucket = rest 17. } } } } 18. if map.size.to_double() / map.length.to_double() >= load { // 根据负载重新分配 19. resize() 20. } 21. } 8 哈希表:直接寻址 虽0 码力 | 27 页 | 448.83 KB | 1 年前3
Go 101 (Golang 101) v1.21.0CSP model) and select mechanisms to do synchronizations between goroutines. the container types map and slice are first-class citizens. polymorphism through interfaces. value boxing and reflection through keywords: 1| break default func interface select 2| case defer go map struct 3| chan else goto package switch 4| const fallthrough if package, type and var are used to declare all kinds of code elements in Go programs. chan, interface, map and struct are used as parts in some composite type denotations. break, case, continue, default, else0 码力 | 630 页 | 3.77 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













