Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-11-21 21:13:00


shunsuke wrote:
> Joel de Guzman wrote:
>> shunsuke wrote:
>>> Hi,
>>>
>>> I'm trying to fix ticket #1396: http://svn.boost.org/trac/boost/ticket/1396
>>> Any hint?
>> I just replied to that in the ticket :-) HTH.
>
> Hmm, your `identity` implementation seems wrong.
> `result<Fun(int)>` invocation means that the argument is rvalue
> by the definition of result_of behavior.
> Therefore, you can't return mutable reference to `int`.

Well, it's just for that specific case. Did you intend the
transform to be generic? I didn't think so when you had
it hard coded to int. I guess, it really depends on what
your intent is. A transform cannot, in general, return a
reference. What if the input is computed on the fly,
like, say:

     mpl::vector_c<int, 1, 2, 3>

?

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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