Skip to content

Commit 70ce84e

Browse files
authored
Merge branch 'nmslib:develop' into develop
2 parents 013def5 + b977d25 commit 70ce84e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hnswlib/bruteforce.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class BruteforceSearch : public AlgorithmInterface<dist_t> {
112112
dist_t dist = fstdistfunc_(query_data, data_ + size_per_element_ * i, dist_func_param_);
113113
labeltype label = *((labeltype*) (data_ + size_per_element_ * i + data_size_));
114114
if ((!isIdAllowed) || (*isIdAllowed)(label)) {
115-
topResults.push(std::pair<dist_t, labeltype>(dist, label));
115+
topResults.emplace(dist, label);
116116
}
117117
}
118118
dist_t lastdist = topResults.empty() ? std::numeric_limits<dist_t>::max() : topResults.top().first;
@@ -121,7 +121,7 @@ class BruteforceSearch : public AlgorithmInterface<dist_t> {
121121
if (dist <= lastdist) {
122122
labeltype label = *((labeltype *) (data_ + size_per_element_ * i + data_size_));
123123
if ((!isIdAllowed) || (*isIdAllowed)(label)) {
124-
topResults.push(std::pair<dist_t, labeltype>(dist, label));
124+
topResults.emplace(dist, label);
125125
}
126126
if (topResults.size() > k)
127127
topResults.pop();

0 commit comments

Comments
 (0)