Boost logo

Boost :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2008-04-05 22:24:11


Eric Niebler wrote:
> return make_plus()( _()(e), _()(e) );
>
> So now how are _ and make_plus defined?
>
> _ is simple -- it is essentially identity which I showed earlier.
>
> make_plus is trickier. It must be optimal and safe. When passed lvalues,
> it should return a new node that holds the children by reference. When
> passed rvalues, it should return a new node that hold the children by value.

I think that, in general,
it depends on context whether or not `return f(a);` is "safe".
It doesn't depend on whether `a` is an lvalue or rvalue.

e.g.
BOOST_FOREACH (char ch, to_const_reference(std::string("abc")) {
}

After all, that's the C++ language, isn't it? :-)

BTW, I think
`result_of<F(int)>::type` is always the same as
`result_of<F(int const &)>::type` in C++03.

Regards,

-- 
Shunsuke Sogame

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