Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Lambda: failure to compile with std::set, OK withstd::vector, bug?
From: Anders Dalvander (boost_at_[hidden])
Date: 2009-01-04 12:09:47


> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net