Skip to content

Commit eb37a9b

Browse files
committed
Merge #87: Avoid copy in self-assign
8ea298b Avoid copy in self-assign (Cory Fields) Pull request description: I believe this was harmless, but it avoids a copy and quiets the clang-tidy check. ACKs for top commit: sipa: utACK 8ea298b Tree-SHA512: 21b3c81a32379acc538c462be0f6685a786722772bc09589356b503195e1dd5da00df2d6c1b6d6d6ce77edbd46a06df64e5c256764ce044257c8f070487b57e5
2 parents fe65576 + 8ea298b commit eb37a9b

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)