Hi,
Compiling the code below with std::vector goes OK, the std::set variant does not compile:
/usr/include/boost/lambda/detail/actions.hpp no matching function for call to ‘boost::lambda::function_adaptor::apply(void (Integer::* const&)(), const Integer&)’
/usr/include/boost/lambda/detail/actions.hpp return-statement with a value, in function returning 'void'
/usr/include/c++/4.3/bits/stl_tree.h invalid type argument of ‘unary *’
Is this a bug or am I doing something wrong (gcc (Debian 4.3.2-1) 4.3.2 / Boost 1.35) ?
#include <iostream>
#include <vector>
#include <set>
#include
#include
#include
struct Integer
{
Integer(int anInt) : integer(anInt){}
bool operator<( const Integer& anInteger) const { return integer < anInteger.integer;}
void print(){std::cout << integer << std::endl;}
int integer;
};
int main(int argc, char* argv[])
{
// std::vector<Integer> collection(5,2);
std::set<Integer> collection(5,2);
// Calling a member function
std::for_each(collection.begin(),
collection.end(),
boost::lambda::bind(&Integer::print, boost::lambda::_1));
}
TIA
--
Groeten,
Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl