From 8ea298bfa77c868862ed05c0bbec15d28b58a5c1 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 5 Jun 2024 17:33:20 +0000 Subject: [PATCH] Avoid copy in self-assign I believe this was harmless, but it avoids a copy and quiets the clang-tidy check. --- include/minisketch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/minisketch.h b/include/minisketch.h index 24d6b4e..b0571d2 100644 --- a/include/minisketch.h +++ b/include/minisketch.h @@ -239,7 +239,7 @@ class Minisketch /** Make this Minisketch a clone of the specified one. */ Minisketch& operator=(const Minisketch& sketch) noexcept { - if (sketch.m_minisketch) { + if (this != &sketch && sketch.m_minisketch) { m_minisketch = std::unique_ptr(minisketch_clone(sketch.m_minisketch.get())); } return *this;