Boost logo

Boost :

From: Matthew Wilson (stlsoft_at_[hidden])
Date: 2003-11-20 00:57:28


> > not an operator bool(), but something convertible to bool (like a
pointer to
> > a member) to prohibit misuse.
> fair enough. But will this compile:
> if ( r1 && r2) ... // r1 and r2 are ranges

Of course.

John, you have an example of this in the book review material, in the
chapter on Operators, I sent you last month. It works for any compiler
(within my range: ), and provides the minimal convertibility wherever
possible. And, IIRC, you asked me the same question, and I assured you it
worked correctly in all conditional expressions. (Maybe I'm misremembering.
Too many pots on the boil. Brain ebbing ...)

It's an STLSoft thing - operator_bool_generator<> - at the moment (and will
be available in v1.7.1, and in a patch with the next recls distribution),
but I'm quite happy to Boostify it now, if there's not a fully-portable
operator boolean in Boost already. It's 100% time and space efficient, and
works with Borland 5.5-5.6, Comeau 4.3.01, 4.3.3, CodeWarrior 7 & 8, Digital
Mars 8.xx, GCC 2.95+, Intel 6+, Visual C++ 4.2+, Watcom 12. For compilers
that can handle it, it does the int X::*() bizo, for those that cannot, it
does X*().

Please advise, boosters. If you don't have one, I can post the source, and
the trick to make it work around the weird bug in every version of VC++, and
will welcome advice on how to Boostify it.

Cheers

Matthew


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