4 Jan
2009
4 Jan
'09
5:09 p.m.
Hi,
Compiling the code below with std::vector goes OK, the std::set variant does not compile:
All elements in a std::set are const, so you need to make the print member function const: struct Integer { Integer(int anInt) : integer(anInt){} bool operator<( const Integer& anInteger) const { return integer < anInteger.integer;} void print() const {std::cout << integer << std::endl;} int integer; }; Regards, Anders Dalvander