|
Boost Users : |
Subject: [Boost-users] [geometry] Cannot compile boost::geometry::intersection
From: Stanley Friesen (friesens_at_[hidden])
Date: 2016-11-16 13:40:07
I am using boost library version 1.54 with gcc --std=c++11.
I am trying a simple use of geometry::intersection as follows:
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_polygon.hpp>
using namespace boost::geometry;
......
typedef model::d2::point_xy<double> point_xy;
model::polygon<point_xy> clipBounds;
// add points to clipBounds
model::polygon<point_xy> area;
// add points to area
model::polygon<point_xy> result;
if(boost::geometry::intersection(area, clipBounds, result))
{
std::cout << std::endl << "Boost intersection, size = " <<
num_points(result) << std::endl;
}
If I comment out the call to intersection, everything compiles. With it I
get:
In file included from /usr/include/boost/serialization/level.hpp:28:0,
from /usr/include/boost/serialization/nvp.hpp:31,
from ...:
/usr/include/boost/mpl/eval_if.hpp: In instantiation of âstruct
boost::mpl::eval_if_c<false,
boost::range_const_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > >,
boost::range_mutable_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > > >â:
/usr/include/boost/range/iterator.hpp:63:63: required from âstruct
boost::range_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > >â
/usr/include/boost/range/value_type.hpp:30:12: required from âstruct
boost::range_value<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > >â
/usr/include/boost/geometry/algorithms/intersection.hpp:97:64: required
from âstatic bool boost::geometry::dispatch::intersection<Geometry1,
Geometry2, Tag1, Tag2, Reverse>::apply(const Geometry1&, const Geometry2&,
GeometryOut&, const Strategy&) [with GeometryOut =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >; Strategy =
boost::geometry::strategy_intersection<boost::geometry::cartesian_tag,
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >,
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >,
boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian>, void>; Geometry1 =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >; Geometry2 =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >; Tag1 = boost::geometry::polygon_tag; Tag2
= boost::geometry::polygon_tag; bool Reverse = false]â
/usr/include/boost/geometry/algorithms/intersection.hpp:201:67: required
from âbool boost::geometry::intersection(const Geometry1&, const Geometry2&,
GeometryOut&) [with Geometry1 =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >; Geometry2 =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >; GeometryOut =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> >]â
/home/stanley/workspace/worldmodel/metric/map/GISCache.cpp:2492:62:
required from here
/usr/include/boost/mpl/eval_if.hpp:60:31: error: no type named âtypeâ in
âboost::mpl::eval_if_c<false,
boost::range_const_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > >,
boost::range_mutable_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > > >::f_ {aka struct
boost::range_mutable_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> > >}â
typedef typename f_::type type;
Since my code is virtually identical to the sample code in the
documentation, I am very puzzled by this. What have I missed? How do I get
this to compile?
(I do find it odd that this error refers to boost/serialization rather than
boost/geometry, but I suppose that has to do with the order of inclusion).
-- View this message in context: http://boost.2283326.n4.nabble.com/geometry-Cannot-compile-boost-geometry-intersection-tp4689954.html Sent from the Boost - Users mailing list archive at Nabble.com.
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