我正在尝试为 PolygonSet 重载 & 运算符,但以以下错误结束。我可以理解 boost::PolygonSet 没有设置功能,但任何人都可以为我提供解决此问题的输入。我试过 view_as 但没有成功。
编码:
Function definition for concept
namespace boost { namespace polygon {
template <>
struct geometry_concept<boost_geom_api::PolygonSet> {
typedef polygon_set_concept type;
}; } }
PolygonSet PolygonSet::operator&(const PolygonSet& right) const {
using namespace boost::polygon::operators;
PolygonSet ps (*this);
ps &= right;
return ps;
}
PolygonSet& PolygonSet::operator&=(const PolygonSet& right) {
using namespace boost::polygon::operators;
using namespace gtl;
pgns &= right.pgns;
return (*this); }
错误:
/polygon_set.cpp:160:19: required from here /u/logic/depot/boost_1_57_0/include/boost/polygon/interval_concept.hpp:168:10:
错误:'struct boost::enable_if, boost::polygon::point_data >'中没有名为'type'的类型</p>
编译期间的消息
/u/logic/depot/boost_1_57_0/include/boost/polygon/detail/polygon_set_view.hpp:198:5: 来自'geometry_type_1& boost::polygon::self_assignment_boolean_op(geometry_type_1&, const geometry_type_2&) [with geometry_type_1 = std::vector ; geometry_type_2 = boost_geom_api::PolygonSet; int op_type = 1]' /u/logic/depot/boost_1_57_0/include/boost/polygon/polygon_set_concept.hpp:419:90: 来自'typename boost::enable_if::type, typename boost::polygon::is_any_polygon_set_type: :type>::type, geometry_type_1>::type& boost::polygon::operators::operator&=(geometry_type_1&, const geometry_type_2&) [with geometry_type_1 = std::vector; geometry_type_2 = boost_geom_api::PolygonSet; 类型名 boost::enable_if
boost::polygon::is_mutable_polygon_set_type::type, 类型名 boost::polygon::is_any_polygon_set_type::type>::type, geometry_type_1>::type = std::vector]' /polygon_set.cpp:160:13: 需要来自这里/u/logic/depot/boost_1_57_0/include/boost/polygon/polygon_90_set_traits.hpp:57:51:错误:'boost::polygon::get_coordinate_type::traits_type {aka struct boost::多边形::polygon_set_traits}'</p>
'typename boost::enable_if::type, typename boost::polygon::is_any_polygon_set_type::type>::type, geometry_type_1>::type& boost::polygon::operators::operator&=(geometry_type_1&, const geometry_type_2&) [与 geometry_type_1 = std::vector; geometry_type_2 = std::vector; 类型名 boost::enable_if::type, 类型名 boost::polygon::is_any_polygon_set_type::type>::type, geometry_type_1>::type = std::vector]'</p>