This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32851] New: 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: 22 Jul 2007 08:30:47 -0000
- Subject: [Bug c++/32851] New: Sort of vector of template class fails
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Sorting a vector comprised of a class defined as a template fails.
-----------------
#include <vector>
#include <algorithm>
class card {
public:
int id;
bool operator<(card const& A) { return this->id < A.id;};
card() {id=0;}
};
template <class MyCard>
class cards {
protected:
std::vector<MyCard> cardvec;
public:
void sort(void){std::sort(cardvec.begin(), cardvec.end());}
cards(){ card aCard ; cardvec.insert(cardvec.end(), aCard);}
};
int main()
{
cards<card> *mycards;
mycards = new cards<card>;
mycards->sort();
}
--
Summary: Sort of vector of template class fails
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: klra67 at freenet dot de
GCC build triplet: i686-linuc-gcc
GCC host triplet: i686-linuc-gcc
GCC target triplet: i686-linuc-gcc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32851