My question is pretty simple: can I do something like this?
Say the class foo contains the following member function:
foo foo::DoSomething(input_type1 input1, input_type2 input2)
{
...
return *this;
}
Using foo:
std::vector<foo> foovec;
input_type1 in1;
input_type2 in2;
...
std::transform(foovec.begin(), foovec.end(), foovec.begin(), std::mem_fun_ref(boost::bind(&foo::DoSomething, in1, in2)));
So is this possible? The problem is largely related to whether boost::bind()the membership / non-character nature of the function that it works on affects . I believe that I can not get around this:
std::transform(foovec.begin(), foovec.end(), foovec.begin(), boost::bind(std::mem_fun_ref(&foo::DoSomething), _1, in1, in2)));
because it std::mem_fun_ref()takes a unary or null function, and DoSomething()a binary one.
source
share