Hi,
I'd like boost::bind to use overloaded member functions, but get an
internal compiler error. Does bind support overload resolution, or is
my compiler at fault? (...or more likely the code!)
system = C++Builder 5 (patched), Win2k, boost_1_28_0
example (simplified) code below
Thanks,
Alex
//--------------------------------------------------------------------
-------
#include <string>
#include <vector>
#include <iostream>
#include
//--------------------------------------------------------------------
-------
struct part
{
std::string name;
int id;
part(std::string name, int id) : name(name), id(id) {}
bool is(int test) { return id == test; }
// bool is(std::string test) { return name == test; } // uncomment
for error };
//--------------------------------------------------------------------
-------
int main()
{
int x = 6; // swap comments here for error //
std::string x("handle"); // swap comments here for error
std::vector<part> parts;
part a("top", 3); parts.push_back(a);
part b("spout", 6); parts.push_back(b);
part c("handle", 9); parts.push_back(c);
std::vector<part>::iterator it =
std::find_if(parts.begin(), parts.end(), boost::bind(&part::is,
_1,
x));
std::cout << it->name << std::endl;
return 0;
}
//--------------------------------------------------------------------
-------