- C/C++ code
#include <hash_map> namespace stdext{ template<> size_t hash_compare< std::string, std::less< std::string > >::operator ()( const std::string& _stringBase ) const { register size_t ret = 0; for( std::string::const_iterator it = _stringBase.begin(); it != _stringBase.end(); ++it ) ret = 5 * ret + *it; return ret; }} typedef stdext::hash_compare< string, std::less< string > > StringHash;
不知以上写法是否哪里错误了,我在eclipse中编译总是会报错:
error: expected initializer before '<' token
------解决方案--------------------