mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
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:

committed by
Christopher Dunn

parent
236db83742
commit
45cd9490cd
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user