首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

hash_地图编译不过

2013-08-01 
hash_map编译不过#if Cactus_COMP_VER 430#define __HashMap::std::tr1::unordered_map#define __HashS

hash_map编译不过
#if Cactus_COMP_VER >= 430
#define __HashMap::std::tr1::unordered_map
#define __HashSet::std::tr1::unordered_set
#define __HashCmp(x)::std::tr1::hash< x >
#else
#define __HashMap::__gnu_cxx::hash_map
#define __HashSet::__gnu_cxx::hash_set
#define __HashCmp(x)::__gnu_cxx::hash< x >
#endif


template <typename K, typename V, typename P = __HashCmp(K), typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
struct hashmap
{
#if Ogre_Container_Use_MemAlloc
typedef typename __HashMap<K, V, P, A> type;
#else
typedef typename __HashMap<K, V, P> type;
#endif
};

class DBCFileManager
{
     typedef Cactus::hashmap<Cactus::String, Cactus::DBCFile*>::typeKeyDBCFileMapType;
KeyDBCFileMapType_DBCFiles;
}

bool DBCFileManager::AddDBCFile(const Cactus::String& strKey, Cactus::DBCFile* pFile)
{
Safe;

if (_DBCFiles.find(strKey) != _DBCFiles.end()) //报错
return false;

Log_Debug("DBCManager::AddDBCFile, " << strKey);
_DBCFiles[strKey] = pFile;

return true;

UnSafe;

return false;
}

报错信息:../DBCFileManager.cpp:131:   instantiated from here
/usr/include/c++/4.4/tr1_impl/hashtable_policy.h:769: error: no match for call to ‘(const Cactus::STLAllocator<std::pair<const std::basic_string<char, std::char_traits<char>, Cactus::STLAllocator<char, Cactus::GeneralAllocPolicy> >, Cactus::DBCFile*>, Cactus::GeneralAllocPolicy>) (const std::basic_string<char, std::char_traits<char>, Cactus::STLAllocator<char, Cactus::GeneralAllocPolicy> >&, const std::basic_string<char, std::char_traits<char>, Cactus::STLAllocator<char, Cactus::GeneralAllocPolicy> >&)’
make: *** [DBCFileManager.o] 错误 1
------解决方案--------------------


楼主代码不全啊,贴代码最好做到准确完整。

热点排行