Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-07-08 20:22:43


----- Original Message -----
From: "Daryle Walker" <darylew_at_[hidden]>

> >> zero_default_quantifiable (default value equivalent to zero, get bool
and !)
>
> You didn't ask about this one, but I'll give an explanation. It assumes
> that the default value of your class is equivalent to zero, and all other
> values are nonzero. This struct lets you define a conversion to bool
based
> on your (non)zero representation. The operator! is the reverse of the
bool
> conversion. I forgot to mention that an operator== needs to be supplied.

Conversions to bool are pretty dangerous, since bool converts implicitly to
all integer types. Probably you should consider using conversion to const
void* instead.

> I added my structs and their macros. I've uploaded the changed
> "operators.hpp," "operators.htm," "operators_test.cpp," and
> "iterators_test.cpp" to the Boost vault on egroups. The file is called
> "dlw_oprs.zip."

Wonderful!

> Notes:
> 1. "iterators_test.cpp" won't run due to problems with operator->*.
Maybe
> someone else can get it working and/or have a better compiler.
> 2. Unlike the above file, I had to add my other new structs manually to
> "operators_test.cpp." I couldn't attach them to operators(2) because my
> compiler ran out of memory doing it. We may have to rethink this weird
> template base attachment scheme.
> 3. I use Metrowerks CodeWarrior Pro 5 (with 5.3 update) on a Mac with 64
MB
> memory.

Hmm. A pretty good compiler, that one. Have you submitted a bug report to
them? They are working on a new release.

> I haven't looked at B&N. Where can I find out about them?

http://www.amazon.com/exec/obidos/ASIN/0201533936/qid=963105114/sr=1-1/102-2
681347-9540120

If that link doesn't work just search for "barton nackmann" in the amazon
books area.

> Besides their
> patterns, we can also do left-over operator patterns for the built-in
types.

Whoops, you lost me again.

> I don't think you can do member pointers (member_dereferenceable) through
> regular pointers (dereferenceable). I don't know if my prototype is
correct
> for that operator, it has been my third attempt.

You're probably right, but I wouldn't be too surprised to find out that your
inability to make this particular obscure thing work was a compiler
limitation.

-Dave


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