
On Tue, Oct 4, 2011 at 8:38 AM, Matt Calabrese <rivorus@gmail.com> wrote:
type operator +( type const&, type const& ) or an equivalent with copies is defined automatically as normal
type operator +( type&&, type const& ) is defined to use += on the first argument which is then move-returned
type operator +( type const& left, type&& right ) is defined as return std::move( right ) + left
type operator +( type&& left, type&& right ) required for disambiguation and just returns std::move( left ) + right
If we're going for C++11, I think the correct way to do this is with a single function: type operator+(type lhs, const type& rhs) { lhs += rhs; return lhs; } That should, given that the class implements move-semantics, be sufficient. -- GMan, Nick Gorski