[cfe-dev] DenseMapInfo pass by reference

Loïc Joly via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 14 09:41:44 PST 2019


Hello,

Today, I discovered that all specializations of DenseMapInfo pass by 
const reference where I would have used pass by value. For instance:

template<> struct DenseMapInfo<char> {
   static inline char getEmptyKey() { return ~0; }
   static inline char getTombstoneKey() { return ~0 - 1; }
   static unsigned getHashValue(const char& Val) { return Val * 37U; }
   static bool isEqual(const char &LHS, const char &RHS) {
     return LHS == RHS;
   }
};

Do you know why?

---

Loïc Joly





More information about the cfe-dev mailing list