This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/32851] Sort of vector of template class fails



------- Comment #3 from klra67 at freenet dot de  2007-07-24 16:10 -------
Subject: Re:  Sort of vector of template class fails

Am Montag, 23. Juli 2007 23:55 schrieb pinskia at gcc dot gnu dot org:

> This is correct, you need to mark operator< as taking a const this
> variable. Like:
>     bool operator<(const card & A)const { return this->id < A.id;};
>
> Once doing that, the program compiles.
You are right, sorry. I am not a C++ expert, and this worked without const on 
another compiler, so I got confused. BTW, I find the error message unclear 
and not helpful, even now that I understand what is going on.

Thanks!
klaus


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32851


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]