Boost logo

Boost :

Subject: [boost] [operators] The future
From: Daniel Frey (d.frey_at_[hidden])
Date: 2011-10-03 04:37:42


Hello,

I would like to gather some feedback on my plan for the future of the Boost.Operators library. As the maintainer, I have to admit it was a pretty easy job for the last years, as not much has happened. The codebase is full of work-arounds, but it seems to be pretty stable. Another member of the list recently suggested an enhancement, see <https://svn.boost.org/trac/boost/ticket/5929>, which I think shows the first of two points that I would like to straighten out in the future:

1) The library currently mixes two domains, arithmetic operators and iterator helpers
2) No rvalue-support

The first point, as already mentioned in the above ticket, could be solved by separating the two parts. I imagine the future Boost.Operators library to concentrate on arithmetic operators, while another, new library could concentrate on iterator and container helpers. Maybe there is an overlap with other libraries (Boost.Iterators), but I'll leave that to others. The (new) Boost.Operators library could provide a base for implementing the iterator helpers just like the current Boost.Operators library does - while there is no dependency in the reversed direction, i.e., the Boost.Operators library does not depend on iterators.

The second point is actually a strong argument for a rewrite and a different interface. I have an implementation ready and as it turns out, rvalue-support could be used to optimize some cases *only* if the type itself is commutative. This property of a type is not taken into account in the current Boost.Operators library, which is why the new implementation has different bases, including a new set of grouped operators. See the end of this post for a list of the proposed bases. Note that the new grouped operators are also a consequence of taking commutativity into account, i.e., a field as a commutative_ring+dividable. Dropping some of the old grouped operators should not be a big deal, since grouped operators are more-or-less convenience only, the real functionality is in the "Simple Arithmetic Operators" (see current documentation).

If there is a strong need, we could also preserve the old implementation as <boost/legacy/operators.hpp>, but I think it's also practical to drop it completely - old Boost versions are still available for those who need them.

To sum up the plan:

- Concentrate on arithmetic operators
- Add rvalue-support
- New set of convenience/grouped operators due to rvalue-support
- Drop the old implementation, iterator support

Someone else (Olaf?) then takes care of the iterator helpers.

So, what do you think?

Regards, Daniel

-----------------------------

Proposed new base classes:

equality_comparable
less_than_comparable
totally_ordered

equivalent
partially_ordered

addable
commutative_addable

subtractable
subtractable_left

multipliable
commutative_multipliable

dividable
dividable_left

modable
modable_left

ring
commutative_ring

field

andable
andable_left
commutative_andable

orable
orable_left
commutative_orable

xorable
xorable_left
commutative_xorable

bitwise
bitwise_left
commutative_bitwise

left_shifttable
right_shiftable
shiftable

incrementable
decrementable
unit_steppable


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