Hunk
Hunk

Reputation: 485

c++11 and boost geometry

I getting started on c++11 and tried to run some example code with boost geometry

#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>

BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)


int main()
{
    typedef boost::tuple<double, double> point;
    typedef boost::geometry::model::polygon<point> polygon;

    polygon poly;
    boost::geometry::read_wkt("polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
        ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))", poly);

    polygon hull;
    boost::geometry::convex_hull(poly, hull);

    using boost::geometry::dsv;
    std::cout
        << "polygon: " << dsv(poly) << std::endl
        << "hull: " << dsv(hull) << std::endl
        ;


    return 0;
}

but i got following errors

/boost/include/boost/geometry/algorithms/detail/recalculate.hpp: In statischer Elementfunktion »static void boost::geometry::detail::recalculate::polygon_to_polygon::apply(Polygon1&,

const Polygon2&, const Strategy&)«: boost/include/boost/geometry/algorithms/detail/recalculate.hpp:145:24: Fehler: »it_source« is not defined

boost/include/boost/geometry/algorithms/detail/recalculate.hpp:146:24: Fehler: »it_dest« is not defined

Anyone has an idea why this is not working ?

Sry i forgot to add my System. I'm using 64Bit Mint 13 with GCC 4.6.3 and boost 1.55

thanks for your help

Upvotes: 0

Views: 594

Answers (1)

sehe
sehe

Reputation: 392883

Apparently your compiler

  • is C++11-challenged
  • is misconfigured

in such a way that BOOST_AUTO_TPL is not working:

    BOOST_AUTO_TPL(it_source, boost::begin(rings_source));
    BOOST_AUTO_TPL(it_dest, boost::begin(rings_dest));

On a c++11 compiler it would expand to

auto it_source = boost::begin(rings_source);
auto it_dest = boost::begin(rings_dest);

However, if you compile that in c++03 mode (e.g. without -std=c++11 on gcc/clang) you might get the error that it_source or it_dest aren't valid types (besides, the rest of the statements/declaration being malformed)

Upvotes: 1

Related Questions