Skip to content

Commit 8ea298b

Browse files
committed
Avoid copy in self-assign
I believe this was harmless, but it avoids a copy and quiets the clang-tidy check.
1 parent 3387044 commit 8ea298b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/minisketch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class Minisketch
239239
/** Make this Minisketch a clone of the specified one. */
240240
Minisketch& operator=(const Minisketch& sketch) noexcept
241241
{
242-
if (sketch.m_minisketch) {
242+
if (this != &sketch && sketch.m_minisketch) {
243243
m_minisketch = std::unique_ptr<minisketch, Deleter>(minisketch_clone(sketch.m_minisketch.get()));
244244
}
245245
return *this;

0 commit comments

Comments
 (0)