From 0c1570071c1aad2247a401217e6e4d224d4e232d Mon Sep 17 00:00:00 2001 From: crvs Date: Tue, 20 Aug 2024 08:14:10 +0200 Subject: [PATCH] Fix neighborhood_points and neighborhood_indices Replace direct list initialization by direct initialization. Fixes Issue #14. --- KDTree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KDTree.cpp b/KDTree.cpp index 8dec720..d75d09c 100644 --- a/KDTree.cpp +++ b/KDTree.cpp @@ -276,7 +276,7 @@ pointIndexArr KDTree::neighborhood(point_t const& pt, double const& rad) { pointVec KDTree::neighborhood_points(point_t const& pt, double const& rad) { auto nbh = std::make_shared(); neighborhood_(root_, pt, rad * rad, /*level*/ 0, *nbh); - pointVec nbhp{nbh->size()}; + pointVec nbhp(nbh->size()); auto const first = [](pointIndex const& x) { return x.first; }; std::transform(nbh->begin(), nbh->end(), nbhp.begin(), first); return nbhp; @@ -285,7 +285,7 @@ pointVec KDTree::neighborhood_points(point_t const& pt, double const& rad) { indexArr KDTree::neighborhood_indices(point_t const& pt, double const& rad) { auto nbh = std::make_shared(); neighborhood_(root_, pt, rad * rad, /*level*/ 0, *nbh); - indexArr nbhi{nbh->size()}; + indexArr nbhi(nbh->size()); auto const second = [](pointIndex const& x) { return x.second; }; std::transform(nbh->begin(), nbh->end(), nbhi.begin(), second); return nbhi;