首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > VSTS >

VS2010 STL hash地图

2013-03-21 
VS2010 STL hashmap版本是 V5.20:0009hashmap继承于_Hash,基本所有实现都是对于_Hash得封装。这里主要是阅

VS2010 STL hashmap

版本是 V5.20:0009

hashmap继承于_Hash,基本所有实现都是对于_Hash得封装。这里主要是阅读一下_Hash的代码流程。


首先是hash_map声明

// 进行表扩充void _Check_size(){// grow table as neededif (max_load_factor() < load_factor()) #if _HAS_INCREMENTAL_HASH_Grow();// too dense, need to grow hash table #else /* _HAS_INCREMENTAL_HASH */{// rehash to bigger tablesize_type _Maxsize = _Vec.max_size() / 2;size_type _Newsize = bucket_count();for (int _Idx = 0; _Idx < 3 && _Newsize < _Maxsize; ++_Idx)_Newsize *= 2;// multiply safely by 8_Init(_Newsize);_Reinsert(end());} #endif /* _HAS_INCREMENTAL_HASH */}


热点排行