$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Daryle Walker (darylew_at_[hidden])
Date: 2000-07-09 23:28:34
on 7/8/00 9:22 PM, David Abrahams at abrahams_at_[hidden] wrote:
> ----- 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.
My class is supposed to be for numeric types, so the conversion to bool may
be appropriate.  A similar class that does void* instead of bool could be
added, to help with Boolean conversions for iterator classes.
[Update many hours later...
    + zero_default_quantifiable needs operator!=, not operator==
    + I've created a new class with the void* conversion
    + It's called null_default_quantifiable
]
>> 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!
I like to note that the documentation is kind-of crappy.  I just stuck
entries to the operator tables, without regard to fitting with the prose.
Also, the classes should be put in some sort of order, maybe by precedence.
[Update many hours later...
    + I've improved the documentation a bit
    + I've added documentation for the null_default_quantifiable
]
>> 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 made a post about it to its newsgroup.
[Update many hours later...
    + I made a _major_ error: I wrote it as operator-> (forgot the '*')!
    + Still got an error after fixing this
]
A question: my operator->* returns a MT&.  This could make a
reference-to-reference problem that I think another part of Boost solves
(call_traits?).  Should I use it?
>> Besides their patterns, we can also do left-over operator patterns for the
>> built-in types.
> 
> Whoops, you lost me again.
I was thinking of doing operator patterns for each built-in type category
(integral, floating, pointer).  I was saying that if B&N patterns already
cover some of these, we should still fill in the rest.