DenseMapInfo pass by reference


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?

Probably copy pasting from other DenseMapInfo over larger types?