multi地图自定义类型,想重写比较函数来改变find和count,但实现不了,能帮忙看看小弟我程序哪里有有关问题么

multimap自定义类型,想重写比较函数来改变find和count,但实现不了,能帮忙看看我程序哪里有问题么
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <math.h>
#include <string>

using std::string;
#include <unordered_map>
using std::unordered_multimap;
using namespace std;
using namespace cv;

class StrCompare{
public:
bool operator()(const Point& a, const Point& b) const {

if (abs(a.x - b.x) + abs(a.y - b.y) < 3) {
return true;
}
else
return false;
}

};

int main()
{
unordered_multimap<Point, int, StrHash, StrCompare> map;
map.insert(make_pair(Point(30, 120), 1));
map.insert(make_pair(Point(220, 120), 2));
map.insert(make_pair(Point(220, 120), 3));
map.insert(make_pair(Point(220, 120), 4));
map.insert(make_pair(Point(220, 119), 5));
map.insert(make_pair(Point(30, 120), 6));
unordered_multimap<Point, int, StrCompare>::iterator iter1;
unordered_multimap<Point, int, StrCompare>::iterator iter2;
for (iter1 = map.begin(); iter1 != map.end();)//遍历
{
int num = map.count((*iter1).first);
iter2 = map.find((*iter1).first);
if (num > 2) {
for (int i = 1; i <= num; i++)
{
cout << (*iter2).first << "  " << i << endl;
iter2++;
}
iter1++;
}
else {

iter1++;

}

}

}


1、我是想count的时候,把key坐标x,y差的和小于3(abs(a.x - b.x) + abs(a.y - b.y) < 3)的坐标当做相等,就如我插入的(Point(220, 120), 4)和(Point(220, 119), 5)运行count和find的时候应该把他当成相等,也就是count为4,但我程序count为3,并没有实现我想要的功能,之前试过重写==,但好像也不行,不只是我写错还是思路不对,应该怎么写才能实现呢
2、还有个问题unordered_multimap不是无序表吗,为什么插入后key自动排序了,map.insert(make_pair(Point(30, 120), 6));这个自动排到前面去了
------解决思路----------------------
引用:
你的StrHash又是怎么实现的呢?
另外unordered_multimap是无序的,但同时也不保证其顺序是按插入顺序排列的

看错了,的确有用到hash函数,这是按照网上改写的
class StrHash{
public:
size_t operator()(const Point a) const {
stringstream ss;
ss << a.x << a.y;
String str = ss.str();

unsigned int hash = 1315423911;
for (int i = 0; i < str.length(); i++){
hash ^= ((hash << 5) + str.at(i) + (hash >> 2));
}
return (hash & 0x7FFFFFFF);
}
};