Skip to content

Commit 33dd3fc

Browse files
committed
Switched to std::ranges::copy
1 parent 03845da commit 33dd3fc

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

ext/faiss/index_binary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ void init_index_binary(Rice::Module& m) {
8080
self.search(n, objects_vec.data(), k, distances_vec.data(), labels_vec.data());
8181
});
8282

83-
std::copy(distances_vec.begin(), distances_vec.end(), distances.write_ptr());
84-
std::copy(labels_vec.begin(), labels_vec.end(), labels.write_ptr());
83+
std::ranges::copy(distances_vec, distances.write_ptr());
84+
std::ranges::copy(labels_vec, labels.write_ptr());
8585
} else {
8686
self.search(n, objects.read_ptr(), k, distances.write_ptr(), labels.write_ptr());
8787
}

ext/faiss/index_rb.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ void init_index(Rice::Module& m) {
171171
self.search(n, objects_vec.data(), k, distances_vec.data(), labels_vec.data());
172172
});
173173

174-
std::copy(distances_vec.begin(), distances_vec.end(), distances.write_ptr());
175-
std::copy(labels_vec.begin(), labels_vec.end(), labels.write_ptr());
174+
std::ranges::copy(distances_vec, distances.write_ptr());
175+
std::ranges::copy(labels_vec, labels.write_ptr());
176176
} else {
177177
self.search(n, objects.read_ptr(), k, distances.write_ptr(), labels.write_ptr());
178178
}
@@ -288,7 +288,7 @@ void init_index(Rice::Module& m) {
288288
[](faiss::IndexIDMap2& self) {
289289
auto n = self.id_map.size();
290290
auto ids = numo::Int64({n});
291-
std::copy(self.id_map.begin(), self.id_map.end(), ids.write_ptr());
291+
std::ranges::copy(self.id_map, ids.write_ptr());
292292
return ids;
293293
});
294294
}

ext/faiss/kmeans.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void init_kmeans(Rice::Module& m) {
2929
"centroids",
3030
[](faiss::Clustering& self) {
3131
auto centroids = numo::SFloat({self.k, self.d});
32-
std::copy(self.centroids.begin(), self.centroids.end(), centroids.write_ptr());
32+
std::ranges::copy(self.centroids, centroids.write_ptr());
3333
return centroids;
3434
})
3535
.define_method(

0 commit comments

Comments
 (0)