摘要: 在C++11中,unordered_map作为一种关联容器,替代了hash_map,unordered_map的底层实现是hash表,所以被称为无序关联容器。不管是map还是unordered_map都是一种 key-map(value) 映射的容器,提供非常高的查找效率,下面我们来了解unorde 阅读全文
posted @ 2021-10-03 17:42 FrostyForest 阅读(445) 评论(0) 推荐(0) 编辑
摘要: C++字符串string类 在C语言里,字符串是用字符数组来表示的,而对于应用层而言,会经常用到字符串,而继续使用字符数组,就使得效率非常低. 所以在C++标准库里,通过类string从新自定义了字符串。 头文件: #include <string> string直接支持字符串连接 string直接 阅读全文
posted @ 2021-10-03 00:47 FrostyForest 阅读(176) 评论(0) 推荐(0) 编辑
摘要: append函数是向string的后面追加字符或字符串。 1).向string的后面加C-string string s = “hello “; const char *c = “out here “; s.append(c); // 把c类型字符串s连接到当前字符串结尾 s = “hello ou 阅读全文
posted @ 2021-10-03 00:23 FrostyForest 阅读(628) 评论(0) 推荐(0) 编辑