std::sort ERROR! HELP!
Hi friends. I need your help, please.
I would like to sort a std::vector<Myclass*> m_whatever;
My classes has a KEY method, which is a float.
Reading over here I did this:
bool CCLScene::MyDataSortPredicate(CCLPolygonsInstance* a, CCLPolygonsInstance* b)
{
return (a->GetZ() < b->GetZ());
}
and in the same file I have this.
std::sort(m_transparent_polygons_instance_list.begin(), m_transparent_polygons_instance_list.end(),MyDataSortPredicate);
But when I compile I get this:
1>Compiling...
1>CLScene.cpp
1>c:\project\colladaloader2\clscene.cpp(163) : error C3867: 'CCLScene::MyDataSortPredicate': function call missing argument list; use '&CCLScene::MyDataSortPredicate' to create a pointer to member
1>c:\project\colladaloader2\clscene.cpp(163) : error C2780: 'void std::sort(_RanIt,_RanIt)' : expects 2 arguments - 3 provided
1> c:\program files\microsoft visual studio 8\vc\include\algorithm(3109) : see declaration of 'std::sort'
1>Build log was saved at "file://c:\project\ColladaLoader2\Debug\BuildLog.htm"
Do you have any idea where the problem is ?
Thanks a lot.
Make MyDataSortPredicate a static method,
and then do:
std::sort(m_transparent_polygons_instance_list.begin(), m_transparent_polygons_instance_list.end(),&CCLScene::MyDataSortPredicate);
and then do:
std::sort(m_transparent_polygons_instance_list.begin(), m_transparent_polygons_instance_list.end(),&CCLScene::MyDataSortPredicate);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement