Boost logo

Boost :

From: Christopher Eltschka (celtschk_at_[hidden])
Date: 2006-07-16 03:09:55

Alberto Ganesh Barbati schrieb:
> Christopher Eltschka ha scritto:
>> Doing some brainstorming, I get the following candidate list for useful
>> automatic operators:
>> * comparison operators from operator< and operator==
>> * operator @ from operator @=
>> * posfix operator++/-- from prefix one
>> * unary operator+ (returning just the object)
>> * maybe also binary - from + and unary -?
>> Any other good candidates?
> That's good, so good that we already have a header in Boost that does
> precisely all that and more. It's <boost/operators.hpp>, documented at
> <>.

Ah, sorry, although I looked into boost before writing the mail, I
somehow missed that, despite its obvious name. However I see that the
boost version forces you to explicitly repeat the class name, i.e. you
have to write

class X: boost::operators<X> { ... };

instead of just

class X: boost::operators { ... };

Is there any specific reason to do so? After all, it seems to work well
without that extra burden. Any specific example where I could get
problems with my version?

Christopher Eltschka

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