(从之前的问题中分离出来)。
有谁知道这里发生了什么?以下代码在MSVC中工作正常,但在intel编译器上没有。
//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::polygon<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);
}
最后一行(boost :: geometry :: area)是产生问题的那一行:
1>d:\boost\boost_1_47_0\boost/typeof/encode_decode.hpp(50): error: incomplete type is not allowed
1> struct encode_type : BOOST_TYPEOF_ENCODE_NS_QUALIFIER::encode_type_impl<V, T>
1> ^
1> detected during:
1> instantiation of class "boost::type_of::encode_type<V, T> [with V=boost::type_of::vector2<boost::mpl::size_t<65592U>, boost::mpl::size_t<65589U>>, T=boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>]" at line 53 of "d:\boost\boost_1_47_0\boost/typeof/modifiers.hpp"
1> instantiation of class "<unnamed>::boost_typeof::encode_type_impl<V, const T> [with V=boost::type_of::vector1<boost::mpl::size_t<65592U>>, T=boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>]" at line 50
1> instantiation of class "boost::type_of::encode_type<V, T> [with V=boost::type_of::vector1<boost::mpl::size_t<65592U>>, T=const boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>]" at line 56 of "d:\boost\boost_1_47_0\boost/typeof/modifiers.hpp"
1> instantiation of class "<unnamed>::boost_typeof::encode_type_impl<V, T *> [with V=boost::type_of::vector0<void>, T=const boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>]" at line 50
1> instantiation of class "boost::type_of::encode_type<V, T> [with V=boost::type_of::vector0<void>, T=const boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator> *]" at line 42 of "d:\boost\boost_1_47_0\boost/geometry/algorithms/detail/calculate_sum.hpp"
1> instantiation of "ReturnType boost::geometry::detail::calculate_polygon_sum<ReturnType, Polygon, Strategy, Policy>::sum_interior_rings(const Rings &, const Strategy &) [with ReturnType=double, Polygon=boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::vector, stlp_std::allocator, stlp_std::allocator>,
1> Strategy=boost::geometry::strategy::area::surveyor<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, void>, Policy=boost::geometry::detail::area::ring_area<const boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>, boost::geometry::iterate_forward, boost::geometry::closed,
1> boost::geometry::strategy::area::surveyor<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, void>>, Rings=stlp_std::vector<boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>, stlp_std::allocator<boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>>>]"
1> at line 54 of "d:\boost\boost_1_47_0\boost/geometry/algorithms/detail/calculate_sum.hpp"
1> instantiation of "ReturnType boost::geometry::detail::calculate_polygon_sum<ReturnType, Polygon, Strategy, Policy>::apply(const Polygon &, const Strategy &) [with ReturnType=double, Polygon=boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::vector, stlp_std::allocator, stlp_std::allocator>, Strategy=boost::geometry::strategy::area::surveyor<boost::geometry::model::d2::point_xy<float,
1> boost::geometry::cs::cartesian>, void>, Policy=boost::geometry::detail::area::ring_area<const boost::geometry::model::ring<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::allocator>, boost::geometry::iterate_forward, boost::geometry::closed, boost::geometry::strategy::area::surveyor<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, void>>]" at line 237 of
1> "d:\boost\boost_1_47_0\boost/geometry/algorithms/area.hpp"
1> instantiation of "boost::geometry::default_area_result<Geometry>::type boost::geometry::area(const Geometry &) [with Geometry=boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<float, boost::geometry::cs::cartesian>, 1, 1, stlp_std::vector, stlp_std::vector, stlp_std::allocator, stlp_std::allocator>]" at line 314 of ".\calculation.cpp"
答案 0 :(得分:0)
这是作为提升中的错误提交的。但Boost并没有正式支持Windows上的英特尔编译器,因此很长一段时间都无法解决。