# # old_revision [2216638a25cd476a18dda793bc10f99f199fa43c] # # patch "database.cc" # from [a5e4bb8071e7d5980ead69694c9c0c45aa8d1541] # to [32d79e633e3c58e98d4928702950f35c237ebbca] # # patch "hash_map.hh" # from [b3b399890667ee2a3f32ee586393030476d35320] # to [4f4fac82fa7d7a8688ac60102296a7cb87c7137d] # # patch "interner.hh" # from [70ca14f55628cab86911c21d846931cb64d3319d] # to [fc34c6daaf946c70a6a32fae30afb04aeb02f67c] # ============================================================ --- database.cc a5e4bb8071e7d5980ead69694c9c0c45aa8d1541 +++ database.cc 32d79e633e3c58e98d4928702950f35c237ebbca @@ -2743,9 +2743,9 @@ if (results.find(curr) == results.end()) { results.insert(curr); - pair range; - range = m.equal_range(c); - for (ancestry_map::const_iterator i = range.first; i != range.second; ++i) + pair \ + range(m.equal_range(c)); + for (ancestry_map::const_iterator i(range.first); i != range.second; ++i) { if (i->first == c) work.push_back(i->second); ============================================================ --- hash_map.hh b3b399890667ee2a3f32ee586393030476d35320 +++ hash_map.hh 4f4fac82fa7d7a8688ac60102296a7cb87c7137d @@ -24,8 +24,46 @@ }; } -#ifdef HAVE_GNUCXX_HASHMAP +#if defined(__GNUC__) && (__GNUC__ >= 4) #define HASHMAP_PRESENT + +#include +#include +#include + +namespace hashmap { + template<> + struct hash + { + size_t operator()(std::string const & s) const + { + return std::tr1::hash()(s); + } + }; + + template + class hash_map : public std::tr1::unordered_map<_Key, + _Value, + hash<_Key>, + equal_to<_Key> > + {}; + + template + class hash_set : public std::tr1::unordered_set<_Key, + hash<_Key>, + equal_to<_Key> > + {}; + + template + class hash_multimap : public std::tr1::unordered_multimap<_Key, + _Value, + hash<_Key>, + equal_to<_Key> > + {}; +} + +#elif defined(HAVE_GNUCXX_HASHMAP) +#define HASHMAP_PRESENT #include #include #include ============================================================ --- interner.hh 70ca14f55628cab86911c21d846931cb64d3319d +++ interner.hh fc34c6daaf946c70a6a32fae30afb04aeb02f67c @@ -37,11 +37,10 @@ } T intern(std::string const & s, bool & is_new) { - std::pair res; T t = rev.size(); // if fwd already contains an entry with key s, this just finds // that and returns it - res = fwd.insert(make_pair(s, t)); + std::pair res(fwd.insert(make_pair(s, t))); is_new = res.second; if (is_new) rev.push_back(s);