File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 5
5
#include < cstdint>
6
6
#include < tuple>
7
7
#include < vector>
8
+ #include < cassert>
8
9
9
10
namespace kdbush {
10
11
@@ -26,6 +27,9 @@ class KDBush {
26
27
27
28
static const std::uint8_t defaultNodeSize = 64 ;
28
29
30
+ KDBush (const std::uint8_t nodeSize_ = defaultNodeSize) : nodeSize(nodeSize_) {
31
+ }
32
+
29
33
KDBush (const std::vector<TPoint> &points_, const std::uint8_t nodeSize_ = defaultNodeSize)
30
34
: KDBush(std::begin(points_), std::end(points_), nodeSize_) {
31
35
}
@@ -35,7 +39,16 @@ class KDBush {
35
39
const TPointIter &points_end,
36
40
const std::uint8_t nodeSize_ = defaultNodeSize)
37
41
: nodeSize(nodeSize_) {
42
+ fill (points_begin, points_end);
43
+ }
38
44
45
+ void fill (const std::vector<TPoint> &points_) {
46
+ fill (std::begin (points_), std::end (points_));
47
+ }
48
+
49
+ template <typename TPointIter>
50
+ void fill (const TPointIter &points_begin, const TPointIter &points_end) {
51
+ assert (points.empty ());
39
52
const TIndex size = std::distance (points_begin, points_end);
40
53
41
54
points.reserve (size);
You can’t perform that action at this time.
0 commit comments