Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::polygon::operators] Boolean operations compiler error
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2011-10-17 13:55:54


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_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Björn Piltz
Sent: Monday, October 17, 2011 4:25 AM
To: boost-users_at_[hidden]
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 <dakopoulos_at_[hidden]<mailto:dakopoulos_at_[hidden]>>
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.htm
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<PolygonCollection, PolygonCollection, 1>' 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_at_[hidden]<mailto:Boost-users_at_[hidden]>
http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net