Skip to content

Fix compilation error in KdtreeBoundingBoxNearestNeighbors #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kongyuanchao
Copy link

Summary

This PR fixes the swap function implementation in KdtreeBoundingBoxNearestNeighbors by updating the swapped member variables to match the actual class members.

Changes
Before (incorrect swap members):
swap(this->mean, other.mean);
swap(this->metric, other.metric);
swap(this->samples, other.samples);
swap(this->root, other.root);
swap(this->values, other.values);
swap(this->var, other.var);

After (corrected to existing class members):
swap(this->boundingBox, other.boundingBox);
swap(this->metric, other.metric);
swap(this->checks, other.checks);
swap(this->root, other.root);
swap(this->values, other.values);
swap(this->nodeDataMax, other.nodeDataMax);

Reason
The previous implementation attempted to swap non-existent or outdated members (mean, samples, var), leading to build errors such as:

error: 'class rl::math::KdtreeBoundingBoxNearestNeighbors' has no member named 'var'
This PR corrects that by aligning the swapped fields with the actual member variables of the class.

Environment Tested
Windows 11 / Git Bash
GCC via MSYS2 / MinGW64

Manual build successful after fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant