From: Eric Niebler (eric_at_[hidden])
Date: 2008-04-09 21:07:09
Peter Dimov wrote:
> Eric Niebler:
>> I'm glad we know how to write the identity function object in C++0x.
>> What about in C++03?
> I'd put the C++03 overloads in an #else block; apart from that, this
> identity function object is correct.
OK, thanks. Just for my own understanding, leaving the C++03 overloads
in -- as well as the nested result<> template -- doesn't make it wrong,
correct? Just not minimal.
IIUC, this has implications for people wanting to write TR1-style
function objects today. I think Shunsuke may be right in that we need an
rvalue_wrapper so that it is possible to write function objects that
will continue to work unmodified in C++0x. That is, my use of
reference_wrapper to carry lvalue-ness has it backwards. T const &
should be assumed to be a const lvalue, because it will mean that
unambiguously in C++0x.
FWIW, I think fusion::make_vector()'s use of reference_wrapper is also
-- 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