[英]c++11 and boost geometry
我开始使用C ++ 11并尝试使用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;
}
但是我出现了以下错误
/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«未定义
boost/include/boost/geometry/algorithms/detail/recalculate.hpp:146:24: Fehler: »it_dest« is not defined
有人知道为什么这行不通吗?
对不起,我忘了添加我的系统。 我正在将64Bit Mint 13与GCC 4.6.3和Boost 1.55一起使用
谢谢你的帮助
显然你的编译器
BOOST_AUTO_TPL
无法正常工作:
BOOST_AUTO_TPL(it_source, boost::begin(rings_source));
BOOST_AUTO_TPL(it_dest, boost::begin(rings_dest));
在c ++ 11编译器上,它将扩展为
auto it_source = boost::begin(rings_source);
auto it_dest = boost::begin(rings_dest);
但是,如果您在c ++ 03模式下进行编译(例如,在gcc / clang上未使用-std=c++11
),则可能会收到以下错误信息: it_source
或it_dest
不是有效类型(此外,其余语句/声明格式错误)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.