[boost::polygon::operators] Boolean operations compiler error

Hello all,
I'm using a custom polygon set (PolygonCollection) according to the
guidelines here:
http://www.boost.org/doc/libs/1_47_0/libs/polygon/doc/gtl_custom_polygon_set...
There is one case that I don't get any compiler error:
PolygonCollection p1, p2;
p1 & p2;
There is this case that I do have an error:
PolygonCollection p1, p2;
PolygonCollection p3 = p1 & p2;
The error is: error: conversion from
'boost::polygon::polygon_set_view

You could try:
boost::polygon::assign(p3, p1&p2);
Or, if you're using namespace boost::polygon::operators, you could write:
p3 = p1;
p3 &= p2;
2011/10/17 Dimitris Dakopoulos
Hello all, I'm using a custom polygon set (PolygonCollection) according to the guidelines here: http://www.boost.org/doc/libs/1_47_0/libs/polygon/doc/gtl_custom_polygon_set... There is one case that I don't get any compiler error:
PolygonCollection p1, p2; p1 & p2;
There is this case that I do have an error:
PolygonCollection p1, p2; PolygonCollection p3 = p1 & p2;
The error is: error: conversion from 'boost::polygon::polygon_set_view
' to non-scalar type 'PolygonCollection' requested There is also this case that I have a compiler error:
PolygonCollection p1,p2,p3; p3 = p1 & p2;
The error is:error: no match for 'operator=' in 'p3 = boost::polygon::operators::operator&(const geometry_type_1&, const geometry_type_2&) [with geometry_type_1 = PolygonCollection, geometry_type_2 = PolygonCollection](((const PolygonCollection&)((const PolygonCollection*)(& p1))))' /xxx/Polygon.hpp:182: note: candidates are: PolygonCollection& PolygonCollection::operator=(const PolygonCollection&)
(You can notice that I have overloaded the operator= for my custom polygon set but I got the same error without the suggestion before my implementation)
Any ideas are welcomed!
Dimitris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Yes, this is exactly right. Thank you Bjorn. The reason is that I cannot define a generic assignment operator because the assignment operator is required to be a member function. If you provide your own assignment operator that is generic you can call the boost::polygon::assign from within it, but you would want to add the same SFINAE guards to it that I use on the definition of assign() to make it concept type safe.
Regards,
Luke
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Björn Piltz
Sent: Monday, October 17, 2011 4:25 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [boost::polygon::operators] Boolean operations compiler error
You could try:
boost::polygon::assign(p3, p1&p2);
Or, if you're using namespace boost::polygon::operators, you could write:
p3 = p1;
p3 &= p2;
2011/10/17 Dimitris Dakopoulos
participants (3)
-
Björn Piltz
-
Dimitris Dakopoulos
-
Simonson, Lucanus J