nanoflann icon indicating copy to clipboard operation
nanoflann copied to clipboard

Request for Support with Copy and Move Semantics for KDTree in nanoflann Library

Open cbtxs opened this issue 1 year ago • 1 comments

Hello, I've been using the nanoflann library, and the KDTree algorithm developed by your team is incredibly efficient, greatly benefiting my current project. However, I recently encountered an issue where I need to copy KDTree objects and use move semantics with the operator=. Unfortunately, my C++ skills are limited, and I'm unsure how to achieve this. I kindly request your team to consider adding this functionality or providing guidance on how to accomplish it.

cbtxs avatar Nov 07 '23 16:11 cbtxs

It could be done at the nanoflann level, but in other projects, I have normally used encapsulation into a std::shared_ptr or std::unique_ptr. In that way, we can keep nanoflann as "simple" as possible...

See an example implementation here: https://github.com/MRPT/mrpt/blob/c4e09e25ba225feb64b17396b351de1d23394738/libs/math/include/mrpt/math/KDTreeCapable.h#L716-L753

jlblancoc avatar Nov 08 '23 16:11 jlblancoc