Boost logo

Boost :

Subject: Re: [boost] Boost.Conversion review
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-08-22 03:19:25


Hi Vicente,

On Aug 21, 2011, at 6:31 AM, Vicente J. Botet Escriba wrote:
> I have added a section to the documentation containing a possible approach that could address this issue.
>
> I have added it below.
>
> Best,
> Vicente
>
> How can libraries define and use conversions between unrelated types?

Do I understand that there would be the same problem and possible solution for an overloadable static_cast?

I think the rule you're proposing could be summarized as: the end user must choose which conversions are defined. Thus,
1. The end user can define and use conversions in any way as long as they heed the ODR.
2. Libraries can define conversions only in headers, and they can't cause those headers to be included.
3. Libraries can use conversions, but only in header-only code that is not used by cpp's. (Actually #2 already ensures this, because the cpp would not compile without including conversion definition headers.)

Does this cover it?

Cheers,
Gordon


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