Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-04-09 20:34:15


shunsuke wrote:
> shunsuke wrote:
>> Eric Niebler wrote:
>>> I think that's right so far. Now imagine a simple identity function
>>> object, that just returns its argument unmodified:
>>>
>>> struct identity
>>> {
>>> template<typename Sig>
>>> struct result;
>>>
>>> template<typename This, typename Arg>
>>> struct result<This(Arg)>
>>> {
>>> typedef Arg type;
>>> };
>>>
>>> template<typename Arg>
>>> Arg const &operator()(Arg const &arg)
>>> {
>>> return arg;
>>> }
>>>
>>> // and a non-const overload, too
>>> };
>> Let me clarify.
>> This identity implementation is simply wrong (if you pass an rvalue to identity.)
>> because of inconsistency between decltype and result_of.
>
> Ditto that tr1_function.
> Am I right?

I don't think you are right, at least not for C++03. There is no
decltype, so there can be no inconsistency with it. :-) Do you still
think that the tr1_function wrapper I sent around is wrong, and if so, why?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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