我试图使用点矢量填充点图。我正在尝试做一个棋盘游戏,棋盘上的每个位置都有一个点(x,y)和法律移动向量(点对象)。将填充矢量填充到地图中
我似乎无法将地图KEY作为点。
struct Point
{
Point() {}
Point(int ix, int iy) :x(ix), y(iy) {}
int x;
int y;
};
Point p_source (2,2);
Point p_next1 (1,2);
Point p_next2 (1,3);
Point p_next3 (1,4);
map <Point, vector<Point> > m_point;
dict[p_source].push_back(p_next1);
dict[p_source].push_back(p_next2);
dict[p_source].push_back(p_next3);
这是错误的,我得到
In member function 'bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Point]':|
instantiated from '_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = Point, _Tp = std::vector, std::allocator >, std::allocator, std::allocator > > >, _Compare = std::less, _Alloc = std::allocator, std::allocator >, std::allocator, |
instantiated from here|
c:\program files (no match for 'operator<' in '__x < __y'| ||=== Build finished: 1 errors, 0 warnings ===|
给答案是:好。解释错误:无价。 – chris