Skip to content

Commit 3b26fb2

Browse files
committed
making copying slightly more efficient
1 parent 5674760 commit 3b26fb2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

include/cpp-json/value.tcc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ inline value::value(const value &other) : type_(other.type_) {
156156
// Name: operator=
157157
//------------------------------------------------------------------------------
158158
inline value &value::operator=(const value &rhs) {
159-
value(rhs).swap(*this);
159+
if(this != &rhs) {
160+
value(rhs).swap(*this);
161+
}
160162
return *this;
161163
}
162164

0 commit comments

Comments
 (0)