idealvin / gitalk

comments for Alvin's blog
0 stars 0 forks source link

STL | Documents for Coost #81

Open idealvin opened 1 year ago

idealvin commented 1 year ago

https://coostdocs.github.io/cn/co/other/stl/

include: co/stl.h.

常用容器 下表中,左边 coost 中的容器与右边相应的 std 版本是等价的,仅内部的内存分配器不同。

coost std co::deque std::deque co::list std::list co::map std::map co::set std::set co::multimap std::multimap co::multiset std::multiset co::hash_map std::unordered_map co::hash_set std::unordered_set 当 key 为 const char* 类型(即 C 风格字符串)时,co::map, co::set, co::multimap, co::multiset, co::hash_map, co::hash_set 会根据字符串内容比较 key 及计算 key 的 hash 值。 #co::lru_map template<typename K, typename V> class lru_map; co::lru_map 是基于 LRU (least recently used) 策略实现的 map,当 map 中元素数量达到上限时,优先替换掉最近最少使用的数据。它基于 co::hash_map 与 co::list 实现,内部元素是无序的。

constructor 1. lru_map(); 2.