By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

sort STL lists

P: n/a
Hello,

got a short question about the sort algorithm of the list container in the
Standard Template Library:

Can I use the sort algorithm with another parameter to sort by? Sort uses
the operator< of the elements it consists of to sort the list. Now Im
interested to sort the elements by another < relation (Im dealing with
multivariate polynomials). Do I have to change the operator to sort the way
it is most often needed and have to sort by hand for the less often cases or
is there a way to tell sort by which relation it should sort the list?

Thank you, Greetings, Hagen.
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi

Yes, You can use a functor for the sort.

It is an object with the '()' overloaded.
Look at http://www.sgi.com/tech/stl for details

Regards, Ron AF Greve.
"Hagen" <ha***@t-online.de> wrote in message
news:bp*************@news.t-online.com...
Hello,

got a short question about the sort algorithm of the list container in the
Standard Template Library:

Can I use the sort algorithm with another parameter to sort by? Sort uses
the operator< of the elements it consists of to sort the list. Now Im
interested to sort the elements by another < relation (Im dealing with
multivariate polynomials). Do I have to change the operator to sort the way it is most often needed and have to sort by hand for the less often cases or is there a way to tell sort by which relation it should sort the list?

Thank you, Greetings, Hagen.

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.