From: Daryle Walker (darylew_at_[hidden])
Date: 2003-11-27 00:20:48
On 11/24/03 5:45 PM, "David Abrahams" <dave_at_[hidden]> 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?
All of the operator helpers need the final type to provide a core routine.
AFAIK, Peter's idiom is to use a pointer-to-member(-function) as the core
Boolean routine; it can't be provided by a library.
(An alternative would be to force the type's author to use "(*this) != T()"
as the Boolean conversion, then define that in a new 'bool_testable' helper.
Of course, that would force the author to define (in)equality operators,
default construction, and a default value suitable for zero/null semantics.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk