|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-11-25 04:11:19
David Abrahams wrote:
> Daniel Frey <daniel.frey_at_[hidden]> writes:
>
>>>>My own feeling is that even if we can't find a solution to those two
>>>>problems then bool_testable is still a sufficiently useful addition to the
>>>>operators library for it to remain. I think it seems an obvious omission
>>>
>>>>from the operators library - providing all operators except bool
>>>
>>>>comparison. Of course this problem should be reflected in the documentation
>>>>if we cannot solve it.
>>
>>As I said above, documenting Peter's idiom is an alternative. AFAICS
>>the best we have so far...
>
> It seems to me it should be possible to make bool_testable use
> Peter's idiom. Am I missing something?
I think Peter's idiom is perfect if applied manually. But if trying to
use it in a base class implementation, it has some drawbacks. The
current bool_testable allows the user to provide a plain and simple
operator bool(), bool_testable adds safety (and operator!()). This
interface is not possible with Peter's idiom, it needs some special
callback. Also, the user can still add operator int() or other
"ambiguous" casts (read: candidated for conversion to bool in absense of
a real operator bool()), which is also not possible with Peter's idiom.
But instead of writing it down all here, this is probably what should go
into the operators library's documentation. Or in a separate document.
Peter? In this case the library would provide documentation, knowledge
and background information, plus a comparison to alternatives. It cannot
offer code to include, only help to implement Peter's technique in the
right way with the right workarounds. In that sense, we could also say
that the technique is already used in other parts of boost and IMHO a
fast-track review is therefore justified. It's also a special situation
as we are not discussing the inclusion of new code, but the removal of
existing code from the CVS.
Regards, Daniel
-- Daniel Frey aixigo AG - financial solutions & technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk