Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-11-21 17:56:27


gast 128 wrote:
> Ok I have an example,
>
> int f(int, int);
> struct X
> {
> int m_i;
> };
>
> X x;
> int i = boost::bind(&f, 1, _1)(boost::bind(&KTstbX::m_i, _1)(x));
> UNREF(i);
>
>
> I guess the new boost does not return ref for members (in react on a
> previous email).

Yes, you are right.

I don't quite see the point of the example, though... the inner bind is not
a nested bind expression. Is this an oversimplified version?

The problem is that bind( f, 1, _1 ) can't take an rvalue as a parameter.
This hasn't changed. It's just that the second bind now returns the member
by value by default.

If you are using a reasonably conforming compiler, you can use
bind<int&>(&KTstbX::m_i, _1) to get the reference.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net