Sign in to follow this  

std::sort ERROR! HELP!

This topic is 3872 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
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

This topic is 3872 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this