From 3c46f4c7337facb89148d26584b4921ba20e1f6a Mon Sep 17 00:00:00 2001 From: presburger Date: Tue, 2 Apr 2024 19:41:08 +0800 Subject: [PATCH] add operator= for index (#487) Signed-off-by: yusheng.ma --- include/knowhere/index.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/knowhere/index.h b/include/knowhere/index.h index bbfe88e4d..06022b311 100644 --- a/include/knowhere/index.h +++ b/include/knowhere/index.h @@ -43,6 +43,20 @@ class Index { node = idx.node; } + Index& + operator=(const Index& idx) { + if (&idx == this) { + return *this; + } + if (idx.node == nullptr) { + node = nullptr; + return *this; + } + idx.node->IncRef(); + node = idx.node; + return *this; + } + Index(Index&& idx) { if (idx.node == nullptr) { node = nullptr;