https://bitbucket.org/purelang/pure-lang/issue/29/pure-stldict-08-fails-to-build-on-os-x-108
--- pure-stlmap/stlhmap.cpp.orig Fri Sep 26 07:21:36 2014 +0200
+++ pure-stlmap/stlhmap.cpp Fri Sep 26 07:32:32 2014 +0200
+// There's no equality defined for tr1::unordered_map, we have to do it
+// ourselves. (Code pilfered from pure-stldict. -ag)
+static bool myequal(pair<pure_expr*,pure_expr*> x,
+ pair<pure_expr*,pure_expr*> y)
+ return same(x.second, y.second);
+template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
+static bool my_is_permutation(ForwardIterator1 first, ForwardIterator1 last,
+ ForwardIterator2 d_first, BinaryPredicate p)
+ tie(first, d_first) = mismatch(first, last, d_first, p);
+ // iterate over the rest, counting how many times each element
+ // from [first, last) appears in [d_first, d_last)
+ ForwardIterator2 d_last = d_first;
+ advance(d_last, distance(first, last));
+ for (ForwardIterator1 i = first; i != last; ++i) {
+ using placeholders::_1;
+ if (i != find_if(first, i, bind(p, _1, *i)))
+ continue; // already counted this *i
+ auto m = count_if(d_first, d_last, bind(p, _1, *i));
+ if (m==0 || count_if(i, last, bind(p, _1, *i)) != m) {
+static bool pxhmequal(pxhmap &x, pxhmap &y)
+ if (&x == &y) return true;
+ if (x.size() != y.size()) return false;
+ for (pxhmap::iterator it = x.begin(); it != x.end(); ) {
+ pair<pxhmap::iterator, pxhmap::iterator>
+ r1 = x.equal_range(it->first),
+ r2 = y.equal_range(it->first);
+ if (distance(r1.first, r1.second) != distance(r2.first, r2.second))
+ if (!my_is_permutation(r1.first, r1.second, r2.first, myequal))
bool stl_shm_equal(px* pxshp1, px* pxshp2)