
"Peter Dimov" <pdimov@pdimov.com> writes:
Anthony Williams:
"Peter Dimov" <pdimov@pdimov.com> writes:
Eric Niebler:
Can you write what the identity function object would look like in C++0x?
struct identity { template<class A> A operator()( A && a ) const { return std::forward<A>( a ); } };
I guess.
No. That will convert lvalues to rvalues.
Try it.
I have, and it doesn't work. Besides, you can see in the signature: it returns "A" by value. You either need the overloads, or you need a trait class to correctly determine whether to return A or A&. Anthony -- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL