Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-05-13 10:37:37


> How's the documentation going? I need it.

Bear with me; C++ is more "native" to me than English. :)

> I've been trying to
> figure out how to call a pointer to member function through a
> pointer, i.e., do what mem_fun does.

I see that you already did. :)

> I have
>
> struct Foo { void bar(int*); };
> std::vector<Foo*> foos;
> int *pi;
>
> At the moment I also have
>
> for_each(foos.begin(), foos.end(), bind2nd(mem_fun(&Foo::bar), pi));
>
> and thought I'd see if I could do this using your library. I tried
> replacing it with
>
> for_each(foos.begin(), foos.end(), apply(&Foo::bar,*arg1,lv(pi)));
>
> but no luck. It would seem you can't dereference arg1 - is that
> right?

This is the correct way to do it. The initial version of expression.hpp was
probably missing several dereference_traits specializations. I tried your
example with 1.01.000512 and it compiles as is. You don't even need the lv()
around pi.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk