Boost logo

Boost :

From: dan marsden (danmarsden_at_[hidden])
Date: 2007-07-12 15:52:56

Tobias Schwinger wrote:
>It's wrong to have the signature for result_of contain references:
>The result_of specification says the parameter types in the signature
>type should be interpreted as types of L-Value arguments used in a call
>expression (cited from memory).
>To understand why this strategy makes sense let's consider a simple call
> identity i;
> int j;
> result_of<identity(int)>::type k = i(j);
>It should compile fine. I can't (and don't want to) know that the
>L-Value 'j' is bound to a reference!
>Even if the argument actually /is/ a reference it doesn't make much
>sense to tell result_of about it - it makes no difference for the
>outcome and just makes nested 'result' metafunctions tedious (if not
>impossible) to implement.

TR1 state:

"Given an rvalue f of type F and values t1, t2, ..., tN of types T1, T2, ..., TN, respectively, the type member
is the result type of the expression f(t1, t2, ...,tN). The values ti are lvalues when the corresponding type Ti is
a reference type, and rvalues otherwise."

I read this as saying result_of<identity(int)>::type says "I'm passing an rvalue", and result_of<identity(int&)>::type says "I'm passing an r-value". Are you saying this interpretation is incorrect? Or did I misunderstand what you were saying?



Yahoo! Answers - Got a question? Someone out there knows the answer. Try it

Boost list run by bdawes at, gregod at, cpdaniel at, john at