struct vector_nodes_less
{
inline bool operator()(const Vector2i& a, const Vector2i& b) const
{
if (a.x == b.x && a.y == b.y) return false;
if (a.x < b.x && a.y < b.y) return true;
if (a.x > b.x && a.y > b.y) return false;
return (a.x < b.x || a.y < b.y);
}
};
typedef std::map <Vector2i, node*, vector_nodes_less> vector_nodes;
Run Code Online (Sandbox Code Playgroud)
当我使用上述类型进行操作时,它会抛出无效的运算符<.
当键(0,0)(0,1)和I对(1,0)向量键执行操作时,会发生这种情况.
我明白我需要弱的严格排序,但我的功能应该是好的吗?
任何帮助都会受到欢迎,因为这会减慢我的速度.
问候
山姆