Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > sort STL lists

Reply
Thread Tools

sort STL lists

 
 
Hagen
Guest
Posts: n/a
 
      11-20-2003
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.


 
Reply With Quote
 
 
 
 
Moonlit
Guest
Posts: n/a
 
      11-20-2003
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" <(E-Mail Removed)> wrote in message
news:bpjflv$3b6$00$(E-Mail Removed)-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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List of lists of lists of lists... =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==?= Python 5 05-15-2006 11:47 AM
is this true? sort algo on STL Lists Bit byte C++ 2 04-06-2006 09:19 PM
Re: When will Thunderbird support sort in place (in context sort)? Ron Natalie Firefox 0 02-02-2006 04:38 AM
xsl:sort lang="es" modern vs. tradidional Spanish sort order nobody XML 0 06-01-2004 06:25 AM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM



Advertisments