Skip to content

Commit

Permalink
add operator= for index (#487)
Browse files Browse the repository at this point in the history
Signed-off-by: yusheng.ma <yusheng.ma@zilliz.com>
  • Loading branch information
Presburger authored Apr 2, 2024
1 parent 2ec2622 commit 3c46f4c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/knowhere/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ class Index {
node = idx.node;
}

Index<T1>&
operator=(const Index<T1>& idx) {
if (&idx == this) {
return *this;
}
if (idx.node == nullptr) {
node = nullptr;
return *this;
}
idx.node->IncRef();
node = idx.node;
return *this;
}

Index(Index<T1>&& idx) {
if (idx.node == nullptr) {
node = nullptr;
Expand Down

0 comments on commit 3c46f4c

Please sign in to comment.