son*_*ong 3 c++ hash ambiguous
在中mdart/mdart_function.h,hash定义了功能。
inline nsaddr_t hash(nsaddr_t id) {
bitset<ADDR_SIZE> tempAddress_ (id);
bitset<ADDR_SIZE> address_;
for(unsigned int i=0; i<ADDR_SIZE; i++) {
if (tempAddress_.test(i)) {
address_.set(ADDR_SIZE - 1 - i);
}
}
address_.flip(ADDR_SIZE - 1);
nsaddr_t temp = (nsaddr_t) address_.to_ulong();
#ifdef DEBUG
fprintf(stdout, "\thash = %s\n", bitString(temp));
#endif
return temp;
}
Run Code Online (Sandbox Code Playgroud)
在另一个源文件中,hash使用正确的头文件引用该函数,包括:
nsaddr_t dstAdd_ = hash(reqId);
Run Code Online (Sandbox Code Playgroud)
但是,还有另一个hash,std::hash它抛出error: reference to 'hash' is ambiguous在我构建它时。
有什么方法可以指定hash尝试使用哪些源代码?我知道std::hash,但是hash在头文件中呢?
| 归档时间: |
|
| 查看次数: |
3778 次 |
| 最近记录: |