mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 15:16:47 +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
@@ -196,10 +196,9 @@ ValueInternalMap::ValueInternalMap( const ValueInternalMap &other )
|
||||
|
||||
|
||||
ValueInternalMap &
|
||||
ValueInternalMap::operator =( const ValueInternalMap &other )
|
||||
ValueInternalMap::operator=(ValueInternalMap other)
|
||||
{
|
||||
ValueInternalMap dummy( other );
|
||||
swap( dummy );
|
||||
swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user