This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/32851] Sort of vector of template class fails
- From: "klra67 at freenet dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jul 2007 16:10:04 -0000
- Subject: [Bug libstdc++/32851] Sort of vector of template class fails
- References: <bug-32851-10536@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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