Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: list.sort ( compare )

Reply
Thread Tools

Re: list.sort ( compare )

 
 
Victor Bazarov
Guest
Posts: n/a
 
      06-26-2003
"Robert William Vesterman" <> wrote...
> I'm trying to use the version of list.sort that takes a comparison
> parameter. I can't get it to compile on one particular platform - on
> another platform it's fine. Here's what I'm doing reduced to a simple
> example:
>
> #include <list>
>
> using namespace std;
>
> struct comp
> {
> bool operator() ( const int *lhs, const int *rhs ) const
> {
> return *lhs < *rhs;
> }
> };
>
> int main()
> {
> list<int *> blah = list<int *>();
> blah.sort ( comp() );
> return 0;
> }
>
> When I try to compile that (on this one particular platform), the
> compiler tells me that blah.sort() is being passed too many arguments.
> On the other platform, it compiles fine.
>
> The STL documentation for the offending platform claims to support
> list.sort ( compare ), specifically:
>
> template <class Compare> void sort ( Compare comp);
>
> Any idea what's wrong?


Yes. Two things can be wrong: the documentation and the newsgroup
you're posting to. You should either pick a different library
implementation, or complain to your compiler vendor about the
documentation being incorrect. In any case, your code if fine
as far as C++ is concerned. Perhaps you can get more help in
a forum dedicated to programming on "this one particular platform"
or devoted to the compiler you're using on that platform...

Victor


 
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
Compare 2 arrays consisting of hashes Frodo Larik Perl 1 05-30-2004 05:02 PM
How to compare strings Thomas Reinemann VHDL 0 05-27-2004 02:24 PM
compare unsigned Matthias Alles VHDL 1 05-14-2004 03:14 PM
Compare pairs of bits between two slv's ? Tony Benham VHDL 3 11-02-2003 12:29 PM
Perl Newbie: compare two files contents with same pattern YC Perl 1 08-13-2003 10:42 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57