Compiling this example
#include <boost/bind.hpp>
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(int , char** )
{
vector<string> test;
test.push_back("xtest2");
test.push_back("test3");
ostream_iterator<string> out_it(cout, "\n");
remove_copy_if(test.begin(), test.end(), out_it,
boost::bind(boost::algorithm::starts_with, _1, "x"));
}
fails with error
no matching function for call to
‘bind(<unresolved overloaded function type>, boost::arg<1>&, const char [2])’
What is wrong with the used bindcall?
So,… resolve
<unresolved overloaded function type>:Ouput:
With a bit more work you can make it less ugly to type. A few variations below: