Boost logo

Boost :

Subject: Re: [boost] [review] Conversion - About specialization, overloading and ODR
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-09-01 02:48:01


Le 31/08/11 19:21, Roman Perepelitsa a écrit :
> 2011/8/31 Gordon Woodhull<gordon_at_[hidden]>
>
>>
>> On Aug 31, 2011, at 12:47 PM, Roman Perepelitsa<
>> roman.perepelitsa_at_[hidden]> wrote:
>>
>>> The rule I follow is that operator+(x, x) can be provided only by the
>> author
>>> of x. If xdoesn't have such operator, third parties can't add one. The
>> same
>>> applies to swap and other functions that are expected to be found by ADL
>> and
>>> form the type's interface.
>> If you were defining operator+(X,Y) you'd have the same problem. Any
>> customization point involving two or more types seems to suffer this
>> problem.
>>
> All I'm saying is that customization points requiring two UDTs are bad. I
> would say that a library that promotes them should't be part of boost.
>
You are surely right as Boost.Conversion need to be especialized for two
types, adn the library has no mean to prevent the user that a bad usage
can fall on ODR violations.

I started this post as I think the same problem could appear for other
Boost libraries with customization points independly of the number of
types. I think that libraries with customization points with one
parameter need to add a warning on the documentation telling the user
that the specific customization of a UDT must be done by the same
library that provides the UDT and that no other library can provide a
customization point for a type provided by a 3rd library.

Best,
Vicente


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