Jump to content
  • Advertisement
Sign in to follow this  
riruilo

std::sort ERROR! HELP!

This topic is 4089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Make MyDataSortPredicate a static method,
and then do:

std::sort(m_transparent_polygons_instance_list.begin(), m_transparent_polygons_instance_list.end(),&CCLScene::MyDataSortPredicate);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!