Lars Gullik Bjønnes wrote:
> Georg Baum <[EMAIL PROTECTED]>
> writes:
>
> | Bar::DoSomething()
> | {
> | std::vector<Foo> x;
> | for_each(x.begin(), x.end(), std::mem_fun_ref(&Foo::Fun));
>
> I guess this should have been &Bar::DoSomething?
No, Foo::Fun() should have no argument. This one compiles:
#include <boost/bind.hpp>
#include <functional>
#include <vector>
#include <algorithm>
class Foo {
public:
void Fun();
};
class Bar {
public:
void DoSomething();
void Fun(Foo const &);
};
void Bar::DoSomething()
{
std::vector<Foo> x;
for_each(x.begin(), x.end(), std::mem_fun_ref(&Foo::Fun));
for_each(x.begin(), x.end(), boost::bind(&Bar::Fun, this, _1));
}
Georg