Skip to content

Commit

Permalink
remove unnecessary new operators
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshoku committed Mar 21, 2022
1 parent 48bbed6 commit 5f074d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python_bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Index {
l2space = new hnswlib::InnerProductSpace(dim);
normalize=true;
} else {
throw new std::runtime_error("Space name must be one of l2, ip, or cosine.");
throw std::runtime_error("Space name must be one of l2, ip, or cosine.");
}
appr_alg = NULL;
ep_added = true;
Expand Down Expand Up @@ -129,7 +129,7 @@ class Index {

void init_new_index(const size_t maxElements, const size_t M, const size_t efConstruction, const size_t random_seed) {
if (appr_alg) {
throw new std::runtime_error("The index is already initiated.");
throw std::runtime_error("The index is already initiated.");
}
cur_l = 0;
appr_alg = new hnswlib::HierarchicalNSW<dist_t>(l2space, maxElements, M, efConstruction, random_seed);
Expand Down Expand Up @@ -668,7 +668,7 @@ class BFIndex {
space = new hnswlib::InnerProductSpace(dim);
normalize=true;
} else {
throw new std::runtime_error("Space name must be one of l2, ip, or cosine.");
throw std::runtime_error("Space name must be one of l2, ip, or cosine.");
}
alg = NULL;
index_inited = false;
Expand All @@ -693,7 +693,7 @@ class BFIndex {

void init_new_index(const size_t maxElements) {
if (alg) {
throw new std::runtime_error("The index is already initiated.");
throw std::runtime_error("The index is already initiated.");
}
cur_l = 0;
alg = new hnswlib::BruteforceSearch<dist_t>(space, maxElements);
Expand Down

0 comments on commit 5f074d5

Please sign in to comment.