Hello, can please someone explain the way to use the std::sort-algorithm!
Well, I have a self-defined struct: MyStruct and a vector<MyStruct>, and now i want to sort this vector with the std::sort-template-function! But i never used template-functions before with their weird declaration!
So please help me!
Ps: it's important that i can implement my own compare-function, i think this is possible with std::sort isn't it ?!
std::sort
Started by Extrawurst, Oct 07 2003 07:49 PM
4 replies to this topic
#1
Posted 07 October 2003 - 07:49 PM
#2
Posted 07 October 2003 - 09:31 PM
check this page, it should answer your question:
http://www.codeproje...stl/stdsort.asp
If you have bugs or compilation errors, you can post some code if you want, so that one can help you better.
http://www.codeproje...stl/stdsort.asp
If you have bugs or compilation errors, you can post some code if you want, so that one can help you better.
#3
Posted 08 October 2003 - 12:07 AM
:) i was about to write up a lengthy text... but that explains it pretty well
If Prolog is the answer, what is the question ?
#4
Posted 08 October 2003 - 05:01 AM
Okay, thanks it seems to be quite easy, but one last question! is it right that the third parameter of std::sort has to be the overloaded "()"-operator getting two pointers of its class and compare them ?
#5
Posted 08 October 2003 - 01:54 PM
okay i got it now, i didn't read the explanations carefully the first time ;)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












