您的位置:首页 > 其它

记录一下 __gnu_cxx::hash_map传一个新allocator的写法

2012-02-23 16:30 344 查看
老得查代码写,这里记录一下:

hash_map(size_type __n, const hasher& __hf,
const key_equal& __eql, const allocator_type& __a = allocator_type())

// 全局的角色指针Allocator
__gnu_cxx::__pool_alloc<Role*> g_rolePtrAlloc;

typedef __gnu_cxx::hash_map<
uint32_t,
Role*,
__gnu_cxx::hash<uint32_t>,
std::equal_to<uint32_t>,
__gnu_cxx::__pool_alloc<Role*> > Roles;
Roles roles(5000, __gnu_cxx::hash<uint32_t>(),
std::equal_to<uint32_t>(), g_rolePtrAlloc);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: