Skip to content

v0.8.3

Latest
Compare
Choose a tag to compare
@Jaybro Jaybro released this 26 Sep 21:05
· 1 commit to master since this release
f6f65d0

Added support for class template argument deduction (CTAD). This means that the space type can now be deduced from the KdTree's constructor argument:

std::size_t max_leaf_size = 10;
std::vector<std::array<double, 2>> points{{0.0, 1.0}, {2.0, 3.0}};

// Deduces to:
// pico_tree::KdTree<std::reference_wrapper<std::vector<std::array<double, 2>>>>
pico_tree::KdTree tree(std::ref(points), max_leaf_size);

If we want to change the metric type or any of the other template arguments of the KdTree, then it's not possible to use the previous deduction method for determining the space type. In this case we can use the pico_tree::MakeKdTree<> helper function to avoid having to explicitly specify the space type and make life a bit easier.

std::size_t max_leaf_size = 10;
std::vector<std::array<double, 2>> points{{0.0, 1.0}, {2.0, 3.0}};

auto tree = 
    pico_tree::MakeKdTree<pico_tree::LInf>(std::ref(points), max_leaf_size);