|
-
December 3rd, 2005, 12:03 PM
#1
Why won't std::list sort?
Hi all,
I can't compile program in which I want to sort std::list:
Code:
void CGeomUtils::sortByRelativePolarAngle(const myPoint & relativeTo, std::list<myPoint> & aList)
{
CGeomUtils::relativePoint = relativeTo;
std::sort(aList.begin(), aList.end(), CGeomUtils::sortByRelativePolarAngle_callback);
}
Code:
bool CGeomUtils::sortByRelativePolarAngle_callback(myPoint a, myPoint b)
{
double pa1 = getRelativePolarAngle(a, CGeomUtils::relativePoint);
double pa2 = getRelativePolarAngle(b, CGeomUtils::relativePoint);
if (IS_EQUIV(pa1, pa2))
return true;
if (pa1 < pa2)
return true;
return false;
}
It won't compile and I'm getting errors like this:
e:\program files\microsoft visual studio\vc98\include\algorithm(592) : error C2784: '_D __cdecl std: perator -(const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce temp
late argument for 'const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &' from 'class std::list<struct _myPoint,class std::allocator<struct _myPoint> >::iterator'
Can someone see where is error?
Thank you.
The sun is the same in the relative way, but you're older
Shorter of breath and one day closer to death
- Roger Waters, 1973
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|