Boost logo

Boost :

Subject: Re: [boost] Formal Review: Boost.Polygon starts today August 24, 2009
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-08-29 16:16:30


Mathias Gaunard wrote:
> Finally, about the operator overloading for set operations, I would
> like
> to be able to avoid pushing the namespace in the global one if
> possible.
> I think it would be nice to have a "ref" function or something that
> would make objects just behave like a reference to the original object
> but within the right namespace so that the operators get picked up by
> ADL. Functions that would return expression templates like discussed
> above
> could also make their return type in the right namespace so that it
> gets picked up by ADL too.

I almost forgot, there is actually a better answer to your question. The operators in the operators namespace are an optional feature of the library. You can instead use the polygon_set_data objects to perform explicit conversions and use the member operators of the polygon_set_data classes.

 polygon_set_data<int>(some_polygon) | polygon_set_data<int>(some_rectangle);

Since operator| is in this case a member function it is found first though ADL.

Luke


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk