Boost logo

Boost :

Subject: Re: [boost] [polygon] Overload resolution for operators fails
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-09-01 16:31:26


Joachim Faulhaber wrote:
> Hi Luke and polygonists,
>
> trying to set up some law based tests for boost::polygon I faced
> difficulties with the overload resolution of operators under msvc-9.
>
> moreover, if my custom PolygonSet conainer implements
> an operator += this operator is *silently* chosen by the
> compiler, so the wrong addition function is called!
>
> Contrary to the traditional understanding of a concept,
> that defines *requirements* for a parameter class it
> can use, we have to take care here, that the client class
> *does not* implement certain operations.
> I am afraid this is not a good thing.
>
> I hope this is fixable, may be the error is on my side
> but I can't see it yet.

Joachim,

How is your interval container library coming along? It was pointed out by one of the reviewer that my interval concept was lacking an interval set concept, which made me think of you and your work.

If I have a generic function with a given name and a function of the same name exists that accepts your type explicitly the compiler will prefer the better match. I have to give my functions names, and I prefer to give them simple and intuitive names. This increases the odds that there is a name collision. The namespace helps, but operator syntax doesn't benefit. If your type has operators defined for it that conflict with my operators you will have to qualify your calls to my operators with the namespace, which is unfortunate, but the concept system itself is not broken by this, just the convenience of calling the operator functions.

Thanks for taking the time to look at my library, what you are doing with loki looks very interesting,
Luke


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