首先,非常感谢新的boost :: geometry库背后的人们!
这个问题取代了之前我已经分成两部分的问题,因为两个单独的问题变得更加清晰。
我已经阅读了http://www.boost.org/doc/libs/1_47_0/libs/geometry/doc/html/geometry/design.html,它解释了特征机制,但对于为什么这段代码无法编译更明智......
//code to calculate area of convex hull from a set of points
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_point.hpp>
double convex_hull_area()
{
using boost::geometry::model::d2::point_xy;
using boost::geometry::append;
using boost::geometry::make;
//this bit works if I use a polygon instead of multi_point
boost::geometry::model::multi_point<point_xy<float> > all_points_in_radius;
append(all_points_in_radius,make<point_xy<float> >(0,0));
append(all_points_in_radius,make<point_xy<float> >(3,0));
append(all_points_in_radius,make<point_xy<float> >(3,3));
append(all_points_in_radius,make<point_xy<float> >(2,1));
boost::geometry::model::polygon<point_xy<float> > hull;
boost::geometry::convex_hull(all_points_in_radius,hull);
return boost::geometry::area(hull);
}
第一个错误是
Error 1 error C2039: 'apply' : is not a member of 'boost::geometry::dispatch::for_each_range<Tag,Geometry,Actor,IsConst>' d:\boost\boost_1_47_0\boost\geometry\algorithms\detail\for_each_range.hpp 115 boost_geom_test
如果我使用多边形而不是多点,代码工作正常,但可能是我不需要的开销。发生了什么事?
答案 0 :(得分:3)
原来这是一个提升中的错误。它现在固定在头版本中,应该在1.49.0中推出。