Boost logo

Boost Users :

Subject: Re: [Boost-users] can not compile nearest neighbors in d dimensions
From: Georgios Samaras (georgesamarasdit_at_[hidden])
Date: 2014-04-16 13:09:02


I increased and it compile. However, I am -again- not able to continue,
because now it says point not declared..

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

namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;

template <int CompileTimeDimension>
void do_something()
{
    typedef bg::model::point<float, CompileTimeDimension,
bg::cs::cartesian> point;
    bgi::rtree<point, bgi::linear<8> > rt;
}

template <std::size_t D, std::size_t N>
struct fill
{
    template <typename Point>
    static void apply(Point& p, typename bg::coordinate_type<Point>::type
const& v)
    {
        bg::set<D>(p, v);
        fill<D + 1, N>::apply(p, v);
    }
};
template <std::size_t N>
struct fill<N, N>
{
    template <typename Point>
    static void apply(Point&, typename bg::coordinate_type<Point>::type
const&) {}
};

int main()
{
    int M;
    M = 100;
    if ( M == 100 )
        do_something<100>();
        else if ( M == 10000 )
        do_something<10000>();
        else
        std::cerr << "invalid dimension!";
    point p;
    if ( M == 100 )
        fill<0, 100>::apply(p, 5);
        else if ( M == 10000 )
        fill<0, 10000>::apply(p, 5);
        else
        std::cerr << "invalid dimension!";
    return 0;
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net