We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b8a337e commit 1e22d35Copy full SHA for 1e22d35
include/kdbush.hpp
@@ -51,6 +51,8 @@ class KDBush {
51
assert(points.empty());
52
const TIndex size = static_cast<TIndex>(std::distance(points_begin, points_end));
53
54
+ if (size == 0) return;
55
+
56
points.reserve(size);
57
ids.reserve(size);
58
test.cpp
@@ -42,8 +42,14 @@ static void testRadius() {
42
assert(std::equal(expectedIds.begin(), expectedIds.end(), result.begin()));
43
}
44
45
+static void testEmpty() {
46
+ auto emptyPoints = std::vector<TPoint>{};
47
+ kdbush::KDBush<TPoint> index(emptyPoints);
48
+}
49
50
int main() {
testRange();
testRadius();
+ testEmpty();
return 0;
0 commit comments