Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-11-16 22:57:13

> Beman Dawes wrote:
>> Dave Abrahams' boost/operators.hpp with a bit of documentation and a
>> test/demonstration program is now available on the web site.
> What a convenient tool this library will be!
> For the multipliable specialization, it wasn't initially obvious to me
> why it was there. A comment like the following would make the intent
> more clear:
> // The above definition of multipliable is ambiguous if T and U are
> the same type.
> // This specialization provides a single (and therefore unambiguous)
> operator for that case.
> (Hopefully, that is the right explanation.)

That explanation is backwards in a way. The specialization was there first.
I generalized it to get the 2-type versions, but you're right that the
general version wouldn't work for a single type.

> For the general definition of multipliable, what is the reason for the
> default argument for U?

It's there so that you don't have to supply 2 template arguments in order to
use the specialization, which is the usual case.

> These same issues apply to all the commutitive operators, although
> it's only necessary to document one.
> For the non-commutitive operators, such as subtractable, what is the
> reason for the:
> (1) default argument for U
> (2) specialization

I don't understand the question about the "non-commutative" operators[sic]
(op< isn't really commutative, but I get your meaning). The usage is
completely uniform for all operators.

Maybe this helps: just because A - B makes sense doesn't mean that B - A
makes sense. Imagine, for example that A is a set of X and B is an X.



Boost list run by bdawes at, gregod at, cpdaniel at, john at