struct CoorEx
{
COOR co;
bool operator < (const CoorEx& cc ) const
{
if (algv3::ISZERO( cc.co.x - this->co.x ))
{
return cc.co.y < this->co.y;
}
else if (algv3::ISZERO( cc.co.y - this->co.y))
{
return cc.co.x < this->co.x;
}
else
return ( cc.co.x < this->co.x );
}
CoorEx& operator=( const CoorEx &cc)
{
this->co.x = cc.co.x;
this->co.y = cc.co.y;
this->co.z = cc.co.z;
return *this;
}
};
记录一下结构体排序的问题(vector,map)
最新推荐文章于 2022-03-01 14:35:20 发布
本文介绍了一种自定义的坐标结构CoorEx,并实现了坐标之间的比较操作与赋值操作。通过使用algv3::ISZERO函数判断浮点数是否为零来确保比较的准确性。
2034

被折叠的 条评论
为什么被折叠?



