Hi,
Would like to do the following with boost::lambda::bind
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <algorithm>
using namespace boost::lambda;
struct Foo{
std::string get(){ ... }
};
std::vector<Foo> array; // say it is already populated
std::vector<std::string> tr; // the transformed
instead using my handcrafted for loop, I would like to transform the
std::list<Foo>::iterator endIter=array.end ();
for (std::list<Foo>::iterator iter=array.begin(); iter!=endIter ;++iter)
{
noExtResults.push_back
(iter.get().replace (0,5, ""));
}
I know it should be something like:
std::transform (array.begin(), array.end (), std::back_inserter(tr),
bind(&Foo::get, _1));
So here I'm stuck. The bind function will know to extract the
string using get. But how to I get that string and do something like:
bind(&std::string::replace (???))
Thanks in advance for your kind help,
Kobi.