O
osama178
Hi,
I am just starting to read about and learn boost. I wrote this
program, but it won't compile:
-------------
#include <iostream>
#include <functional>
#include <boost/bind.hpp>
class item
{
public:
item( int id) : id_(id) {}
int id() const {return id_; }
private:
int id_;
};
class comparator
{
public:
bool operator () (const item& e)
{
return boost::bind( std::less<int>(), 10,
boost::bind(&item::id, _1));
}
};
---------------------
the error I get is:
cannot convert from 'boost::_bi::bind_t<R,F,L>' to 'bool'
my understanding is, the call:
return boost::bind( std::less<int>(), 10,
boost::bind(&item::id, _1));
would be transferred to a call to std::less, with 10 as the first
parameter, and e.id() as the second paramter. And std::less returns a
boolean.
Any help is appreciated.
I am just starting to read about and learn boost. I wrote this
program, but it won't compile:
-------------
#include <iostream>
#include <functional>
#include <boost/bind.hpp>
class item
{
public:
item( int id) : id_(id) {}
int id() const {return id_; }
private:
int id_;
};
class comparator
{
public:
bool operator () (const item& e)
{
return boost::bind( std::less<int>(), 10,
boost::bind(&item::id, _1));
}
};
---------------------
the error I get is:
cannot convert from 'boost::_bi::bind_t<R,F,L>' to 'bool'
my understanding is, the call:
return boost::bind( std::less<int>(), 10,
boost::bind(&item::id, _1));
would be transferred to a call to std::less, with 10 as the first
parameter, and e.id() as the second paramter. And std::less returns a
boolean.
Any help is appreciated.