hash_map如何初始化大小?
因为我存入的数据量很大,使用的hash_map如何初始化大小?我试了下hash_map<char* ,int> map(500000),提示如下的错误:error C2664: 'stdext::hash_map<_Kty,_Ty>::hash_map(const stdext::hash_compare<_Kty,_Pr> &)' : cannot convert parameter 1 from 'int' to 'const stdext::hash_compare<_Kty,_Pr> &'
1> with
1> [
1> _Kty=char *,
1> _Ty=int,
1> _Pr=std::less<char *>
1> ]
1> and
1> [
1> _Kty=char *,
1> _Pr=std::less<char *>
1> ]
1> Reason: cannot convert from 'int' to 'const stdext::hash_compare<_Kty,_Pr>'
1> with
1> [
1> _Kty=char *,
1> _Pr=std::less<char *>
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
到底要如何初始化大小啊,求教了啊!
[解决办法]
// 直接这样就可以了,不需要初始化其大小hash_map <char* ,int> hmap;