GTest TYPED Test

#include <gtest/gtest.h>

template< typename Type >
class MyTestFixture : public ::testing::Test
{};

TYPED_TEST_SUITE_P( MyTestFixture );

TYPED_TEST_P( MyTestFixture, Case1 )
{
  TypeParam ...;
  ...
}

TYPED_TEST_P( MyTestFixture, Case2 )
{
  TypeParam ...;
  ...
}

REGISTER_TYPED_TEST_SUITE_P( MyTestFixture, Case1, Case2 );

typedef ::testing::Types< ClassA, ClassB > TestTypes;
INSTANTIATE_TYPED_TEST_SUITE_P( MyTest, MyTestFixture, TestTypes);

Use boost r-tree to find the nearest point

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/index/rtree.hpp>

using PointType = boost::geometry::model::point<float,3,boost::geometry::cs::cartesian>;

// Build the r-tree
boost::geometry::index::rtree< PointType,boost::geometry::index::quadratic<16> > rtree;
for(...) {
  rtree.insert( PointType( x, y, z ) );
}

// Find the nearest point
PointType roiPoint( x, y, z );
std::vector< PointType > nearestPoints;
rtree.query( boost::geometry::index::nearest( roiPoint, 1 ), std::back_inserter( nearestPoints ) );
const auto nearest = nearestPoints[0];
std::cout << nearest.get<0>() << ", "<< nearest.get<1>() << ", " << nearest.get<2>() << std::endl;