模板特化
1. DenseMapInfo模板结构体
DenseMapInfo模板结构体2. 为指针类型的特化
template<typename T>
struct DenseMapInfo<T*> {
static inline T* getEmptyKey() {
uintptr_t Val = static_cast<uintptr_t>(-1);
return reinterpret_cast<T*>(Val);
}
static inline T* getTombstoneKey() {
uintptr_t Val = static_cast<uintptr_t>(-2);
return reinterpret_cast<T*>(Val);
}
static unsigned getHashValue(const T *PtrVal) {
return ptr_hash((uintptr_t)PtrVal);
}
static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; }
};3. 为DisguisedPtr类型的特化
DisguisedPtr类型的特化4. 为字符串的特化
5. 为基本类型的特化(如char、int、unsigned等)
char、int、unsigned等)6. 为std::pair类型的特化
std::pair类型的特化7. DenseMapValueInfo
DenseMapValueInfo总结
Last updated