经过一些年的Java和C#编程,现在我又回到了C++。当然,我的编程风格受到这些语言的影响,我倾向于使用一个我经常使用的特殊组件:哈希映射(HASH MAP)。在STL中,有hash_map,但GCC表示它已被弃用,并且我应该使用unordered_map。因此,我转向了unordered_map。我承认,我不确定我所做的东西的可移植性,因为我必须使用编译器开关-std=c++0x来启用这个特性,这是即将发布的标准之一。无论如何,我对此感到满意,只要能使它工作,因为如果我把它放在我的类中
std::unordered_map<unsigned int, baseController*> actionControllers;
并且使用方法:
void baseController::attachActionController(unsigned int *actionArr, int len,
baseController *controller) {
for (int i = 0; i < len; i++){
actionControllers.insert(actionArr[i], controller);
}
}
出现了通常的象形文字,表示找不到插入物...有什么提示吗?