This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

hash_map with unsigned long long keys


Hello,

I need to use a hash_map with unsigned long long keys.

Currently, this type of key is not supported by libstdc++.

I would like to propose the following addition to the file
gcc/libstdc++-v3/include/ext/hash_fun.h:


---------------------------------------------------------------------------------


template<> struct hash<long long> {
  size_t operator()(long long __x) const { return __x; }
};
template<> struct hash<const long long> {
  size_t operator()(const long long __x) const { return __x; }
};

template<> struct hash<unsigned long long> {
  size_t operator()(unsigned long long __x) const { return __x; }
};
template<> struct hash<const unsigned long long> {
  size_t operator()(const unsigned long long __x) const { return __x; }
};

----------------------------------------------------------------------------------


This simple addition on my local development system gave me the expected functionnality currently missing with g++ hash_maps.


Thank you.

--
Martin Beaudoin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]