Switch to copy-and-swap idiom for operator=.

This allows the compiler to elide a copy when rhs is a temporary.
This commit is contained in:
Billy Donahue
2014-09-08 08:00:39 -04:00
committed by Christopher Dunn
parent 236db83742
commit 45cd9490cd
4 changed files with 12 additions and 16 deletions

View File

@@ -280,10 +280,9 @@ ValueInternalArray::ValueInternalArray( const ValueInternalArray &other )
ValueInternalArray &
ValueInternalArray::operator =( const ValueInternalArray &other )
ValueInternalArray::operator=(ValueInternalArray other)
{
ValueInternalArray temp( other );
swap( temp );
swap(other);
return *this;
}