From 1e259b7f47bd1fcfccbf4b55f7b3075583a936aa Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:30:55 +0000 Subject: [PATCH] Codefix: Missing this-> in Kdtree (#13095) --- src/core/kdtree.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/kdtree.hpp b/src/core/kdtree.hpp index 993c36a87c..8d24077f34 100644 --- a/src/core/kdtree.hpp +++ b/src/core/kdtree.hpp @@ -84,7 +84,7 @@ class Kdtree { } else if (count == 1) { return this->AddNode(*begin); } else if (count > 1) { - CoordT split_coord = SelectSplitCoord(begin, end, level); + CoordT split_coord = this->SelectSplitCoord(begin, end, level); It split = std::partition(begin, end, [&](T v) { return TxyFunc()(v, level % 2) < split_coord; }); size_t newidx = this->AddNode(*split); this->nodes[newidx].left = this->BuildSubtree(begin, split, level + 1); @@ -247,7 +247,7 @@ class Kdtree { /* Coordinate of element splitting at this node */ CoordT c = TxyFunc()(n.element, dim); /* This node's distance to target */ - DistT thisdist = ManhattanDistance(n.element, xy[0], xy[1]); + DistT thisdist = this->ManhattanDistance(n.element, xy[0], xy[1]); /* Assume this node is the best choice for now */ node_distance best = std::make_pair(n.element, thisdist); @@ -299,7 +299,7 @@ class Kdtree { { if (node_idx == INVALID_NODE) return 0; const node &n = this->nodes[node_idx]; - return CountValue(element, n.left) + CountValue(element, n.right) + ((n.element == element) ? 1 : 0); + return this->CountValue(element, n.left) + this->CountValue(element, n.right) + ((n.element == element) ? 1 : 0); } void IncrementUnbalanced(size_t amount = 1) @@ -331,12 +331,12 @@ class Kdtree { if (level % 2 == 0) { // split in dimension 0 = x - CheckInvariant(n.left, level + 1, min_x, cx, min_y, max_y); - CheckInvariant(n.right, level + 1, cx, max_x, min_y, max_y); + this->CheckInvariant(n.left, level + 1, min_x, cx, min_y, max_y); + this->CheckInvariant(n.right, level + 1, cx, max_x, min_y, max_y); } else { // split in dimension 1 = y - CheckInvariant(n.left, level + 1, min_x, max_x, min_y, cy); - CheckInvariant(n.right, level + 1, min_x, max_x, cy, max_y); + this->CheckInvariant(n.left, level + 1, min_x, max_x, min_y, cy); + this->CheckInvariant(n.right, level + 1, min_x, max_x, cy, max_y); } } @@ -344,7 +344,7 @@ class Kdtree { void CheckInvariant() const { #ifdef KDTREE_DEBUG - CheckInvariant(this->root, 0, std::numeric_limits::min(), std::numeric_limits::max(), std::numeric_limits::min(), std::numeric_limits::max()); + this->CheckInvariant(this->root, 0, std::numeric_limits::min(), std::numeric_limits::max(), std::numeric_limits::min(), std::numeric_limits::max()); #endif } @@ -368,7 +368,7 @@ public: this->nodes.reserve(end - begin); this->root = this->BuildSubtree(begin, end, 0); - CheckInvariant(); + this->CheckInvariant(); } /** @@ -404,7 +404,7 @@ public: this->InsertRecursive(element, this->root, 0); this->IncrementUnbalanced(); } - CheckInvariant(); + this->CheckInvariant(); } } @@ -423,7 +423,7 @@ public: this->root = this->RemoveRecursive(element, this->root, 0); this->IncrementUnbalanced(); } - CheckInvariant(); + this->CheckInvariant(); } /** Get number of elements stored in tree */