#include <cassert>
#include <iostream>
#include <boost/polygon/polygon.hpp>
using namespace boost::polygon::operators;
int main() {
//lets construct a 10x10 rectangle shaped polygon
typedef boost::polygon::polygon_data<float> Polygon;
typedef boost::polygon::polygon_traits<Polygon>::point_type Point;
Point pts[] = {
boost::polygon::construct<Point>(0, 0),
boost::polygon::construct<Point>(1, 0),
boost::polygon::construct<Point>(1, 1),
boost::polygon::construct<Point>(0, 1) };
Polygon poly;
boost::polygon::set_points(poly, pts, pts+4);
std::cout << "Area: " << boost::polygon::area(poly) << std::endl;
poly += 1; // no match for += operator
std::cout << "Area: " << boost::polygon::area(poly) << std::endl;
return 0;
}
I2luY2x1ZGUgPGNhc3NlcnQ+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCiNpbmNsdWRlIDxib29zdC9wb2x5Z29uL3BvbHlnb24uaHBwPgoKdXNpbmcgbmFtZXNwYWNlIGJvb3N0Ojpwb2x5Z29uOjpvcGVyYXRvcnM7CgppbnQgbWFpbigpIHsKICAgIC8vbGV0cyBjb25zdHJ1Y3QgYSAxMHgxMCByZWN0YW5nbGUgc2hhcGVkIHBvbHlnb24KICAgIHR5cGVkZWYgYm9vc3Q6OnBvbHlnb246OnBvbHlnb25fZGF0YTxmbG9hdD4gUG9seWdvbjsKICAgIHR5cGVkZWYgYm9vc3Q6OnBvbHlnb246OnBvbHlnb25fdHJhaXRzPFBvbHlnb24+Ojpwb2ludF90eXBlIFBvaW50OwogICAgUG9pbnQgcHRzW10gPSB7CiAgICAgICAgYm9vc3Q6OnBvbHlnb246OmNvbnN0cnVjdDxQb2ludD4oMCwgMCksCiAgICAgICAgYm9vc3Q6OnBvbHlnb246OmNvbnN0cnVjdDxQb2ludD4oMSwgMCksCiAgICAgICAgYm9vc3Q6OnBvbHlnb246OmNvbnN0cnVjdDxQb2ludD4oMSwgMSksCiAgICAgICAgYm9vc3Q6OnBvbHlnb246OmNvbnN0cnVjdDxQb2ludD4oMCwgMSkgfTsKCiAgICBQb2x5Z29uIHBvbHk7CiAgICBib29zdDo6cG9seWdvbjo6c2V0X3BvaW50cyhwb2x5LCBwdHMsIHB0cys0KTsKCiAgICBzdGQ6OmNvdXQgPDwgIkFyZWE6ICIgPDwgYm9vc3Q6OnBvbHlnb246OmFyZWEocG9seSkgPDwgc3RkOjplbmRsOwoKICAgIHBvbHkgKz0gMTsgLy8gbm8gbWF0Y2ggZm9yICs9IG9wZXJhdG9yCgogICAgc3RkOjpjb3V0IDw8ICJBcmVhOiAiIDw8IGJvb3N0Ojpwb2x5Z29uOjphcmVhKHBvbHkpIDw8IHN0ZDo6ZW5kbDsKCiAgICByZXR1cm4gMDsKfQo=
prog.cpp: In function 'int main()':
prog.cpp:23:10: error: no match for 'operator+=' (operand types are 'Polygon {aka boost::polygon::polygon_data<float>}' and 'int')
poly += 1; // no match for += operator
^
In file included from /usr/include/boost/polygon/polygon_90_set_concept.hpp:550:0,
from /usr/include/boost/polygon/polygon.hpp:67,
from prog.cpp:4:
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:364:3: note: candidate: template<class coordinate_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and<boost::polygon::operators::y_ps90_pe, typename boost::polygon::is_polygon_90_set_type<polygon_set_type_2>::type>::type, boost::polygon::polygon_90_set_data<coordinate_type> >::type& boost::polygon::operators::operator+=(boost::polygon::polygon_90_set_data<coordinate_type>&, const geometry_type_2&)
operator+=(polygon_90_set_data<coordinate_type_1>& lvalue, const geometry_type_2& rvalue) {
^
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:364:3: note: template argument deduction/substitution failed:
prog.cpp:23:10: note: 'Polygon {aka boost::polygon::polygon_data<float>}' is not derived from 'boost::polygon::polygon_90_set_data<coordinate_type>'
poly += 1; // no match for += operator
^
In file included from /usr/include/boost/polygon/polygon_90_set_concept.hpp:550:0,
from /usr/include/boost/polygon/polygon.hpp:67,
from prog.cpp:4:
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:386:3: note: candidate: template<class geometry_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps90_pe2, typename boost::polygon::is_mutable_polygon_90_set_type<T>::type, typename boost::polygon::is_polygon_90_set_type<polygon_set_type_2>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, const geometry_type_2&)
operator+=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
^
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:386:3: note: template argument deduction/substitution failed:
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp: In substitution of 'template<class geometry_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps90_pe2, typename boost::polygon::is_mutable_polygon_90_set_type<T>::type, typename boost::polygon::is_polygon_90_set_type<polygon_set_type_2>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, const geometry_type_2&) [with geometry_type_1 = boost::polygon::polygon_data<float>; geometry_type_2 = int]':
prog.cpp:23:10: required from here
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:386:3: error: no type named 'type' in 'struct boost::enable_if<mpl_::bool_<false>, boost::polygon::polygon_data<float> >'
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:447:3: note: candidate: template<class geometry_type_1, class coordinate_type_1> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps90_rpe, typename boost::polygon::is_mutable_polygon_90_set_type<T>::type, typename boost::polygon::gtl_same_type<typename boost::polygon::geometry_concept<PointType2>::type, boost::polygon::coordinate_concept>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, coordinate_type_1)
operator+=(geometry_type_1& lvalue, coordinate_type_1 rvalue) {
^
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:447:3: note: template argument deduction/substitution failed:
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp: In substitution of 'template<class geometry_type_1, class coordinate_type_1> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps90_rpe, typename boost::polygon::is_mutable_polygon_90_set_type<T>::type, typename boost::polygon::gtl_same_type<typename boost::polygon::geometry_concept<PointType2>::type, boost::polygon::coordinate_concept>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, coordinate_type_1) [with geometry_type_1 = boost::polygon::polygon_data<float>; coordinate_type_1 = int]':
prog.cpp:23:10: required from here
/usr/include/boost/polygon/detail/polygon_90_set_view.hpp:447:3: error: no type named 'type' in 'struct boost::enable_if<mpl_::bool_<false>, boost::polygon::polygon_data<float> >'
In file included from /usr/include/boost/polygon/polygon_45_set_concept.hpp:440:0,
from /usr/include/boost/polygon/polygon.hpp:76,
from prog.cpp:4:
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp:274:3: note: candidate: template<class geometry_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and_4<boost::polygon::operators::y_ps45_pe, typename boost::polygon::is_mutable_polygon_45_set_type<T>::type, boost::polygon::gtl_yes, typename boost::polygon::is_polygon_45_or_90_set_type<polygon_set_type_2>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, const geometry_type_2&)
operator+=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
^
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp:274:3: note: template argument deduction/substitution failed:
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp: In substitution of 'template<class geometry_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and_4<boost::polygon::operators::y_ps45_pe, typename boost::polygon::is_mutable_polygon_45_set_type<T>::type, boost::polygon::gtl_yes, typename boost::polygon::is_polygon_45_or_90_set_type<polygon_set_type_2>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, const geometry_type_2&) [with geometry_type_1 = boost::polygon::polygon_data<float>; geometry_type_2 = int]':
prog.cpp:23:10: required from here
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp:274:3: error: no type named 'type' in 'struct boost::enable_if<mpl_::bool_<false>, boost::polygon::polygon_data<float> >'
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp:337:3: note: candidate: template<class geometry_type_1, class coordinate_type_1> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps45_rpe, typename boost::polygon::is_mutable_polygon_45_set_type<T>::type, typename boost::polygon::gtl_same_type<typename boost::polygon::geometry_concept<PointType2>::type, boost::polygon::coordinate_concept>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, coordinate_type_1)
operator+=(geometry_type_1& lvalue, coordinate_type_1 rvalue) {
^
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp:337:3: note: template argument deduction/substitution failed:
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp: In substitution of 'template<class geometry_type_1, class coordinate_type_1> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps45_rpe, typename boost::polygon::is_mutable_polygon_45_set_type<T>::type, typename boost::polygon::gtl_same_type<typename boost::polygon::geometry_concept<PointType2>::type, boost::polygon::coordinate_concept>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, coordinate_type_1) [with geometry_type_1 = boost::polygon::polygon_data<float>; coordinate_type_1 = int]':
prog.cpp:23:10: required from here
/usr/include/boost/polygon/detail/polygon_45_set_view.hpp:337:3: error: no type named 'type' in 'struct boost::enable_if<mpl_::bool_<false>, boost::polygon::polygon_data<float> >'
In file included from /usr/include/boost/polygon/polygon_set_data.hpp:1003:0,
from /usr/include/boost/polygon/polygon.hpp:81,
from prog.cpp:4:
/usr/include/boost/polygon/polygon_set_concept.hpp:387:3: note: candidate: template<class geometry_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and_4<boost::polygon::operators::yes_ps_ope, boost::polygon::gtl_yes, typename boost::polygon::is_mutable_polygon_set_type<T>::type, typename boost::polygon::is_any_polygon_set_type<polygon_set_type_2>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, const geometry_type_2&)
operator+=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
^
/usr/include/boost/polygon/polygon_set_concept.hpp:387:3: note: template argument deduction/substitution failed:
/usr/include/boost/polygon/polygon_set_concept.hpp: In substitution of 'template<class geometry_type_1, class geometry_type_2> typename boost::enable_if<typename boost::polygon::gtl_and_4<boost::polygon::operators::yes_ps_ope, boost::polygon::gtl_yes, typename boost::polygon::is_mutable_polygon_set_type<T>::type, typename boost::polygon::is_any_polygon_set_type<polygon_set_type_2>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, const geometry_type_2&) [with geometry_type_1 = boost::polygon::polygon_data<float>; geometry_type_2 = int]':
prog.cpp:23:10: required from here
/usr/include/boost/polygon/polygon_set_concept.hpp:387:3: error: no type named 'type' in 'struct boost::enable_if<mpl_::bool_<false>, boost::polygon::polygon_data<float> >'
/usr/include/boost/polygon/polygon_set_concept.hpp:451:3: note: candidate: template<class geometry_type_1, class coordinate_type_1> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps_rpe, typename boost::polygon::is_mutable_polygon_set_type<T>::type, typename boost::polygon::gtl_same_type<typename boost::polygon::geometry_concept<PointType2>::type, boost::polygon::coordinate_concept>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, coordinate_type_1)
operator+=(geometry_type_1& lvalue, coordinate_type_1 rvalue) {
^
/usr/include/boost/polygon/polygon_set_concept.hpp:451:3: note: template argument deduction/substitution failed:
/usr/include/boost/polygon/polygon_set_concept.hpp: In substitution of 'template<class geometry_type_1, class coordinate_type_1> typename boost::enable_if<typename boost::polygon::gtl_and_3<boost::polygon::operators::y_ps_rpe, typename boost::polygon::is_mutable_polygon_set_type<T>::type, typename boost::polygon::gtl_same_type<typename boost::polygon::geometry_concept<PointType2>::type, boost::polygon::coordinate_concept>::type>::type, geometry_type_1>::type& boost::polygon::operators::operator+=(geometry_type_1&, coordinate_type_1) [with geometry_type_1 = boost::polygon::polygon_data<float>; coordinate_type_1 = int]':
prog.cpp:23:10: required from here
/usr/include/boost/polygon/polygon_set_concept.hpp:451:3: error: no type named 'type' in 'struct boost::enable_if<mpl_::bool_<false>, boost::polygon::polygon_data<float> >'