记录一下结构体排序的问题(vector,map)

版权声明:本文为博主原创文章,未经博主允许不得转载。若有疑问,请邮件:[email protected] https://blog.csdn.net/cloudmq/article/details/79220543

博客迁移:http://www.codeye.top


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;

 }

};

猜你喜欢

转载自blog.csdn.net/cloudmq/article/details/79220543