Boost logo

Boost :

Subject: Re: [boost] [operators] The future of Boost.Operators
From: Daniel Frey (d.frey_at_[hidden])
Date: 2013-04-23 14:16:53


On 23.04.2013, at 19:45, Andrew Ho <helloworld922_at_[hidden]> wrote:

> What about using partial template specialization for handling
> commutative/non-commutative versions? This should make implementing 1) much
> easier, and I think is a slightly more elegant/flexible solution.

I don't see how it would make the implementation any easier, you still need to commutative and the non-commutative version and they can't really re-use each other's code. It also means you end up with a terrible interface, consider

addable1< T >
addable1< T, true > // true what? that doesn't speak for itself

vs.

commutative_addable< T > // ah, this is a commutative operator!
addable< T > // does not have commutative in the name -> doesn't require/exploit it! The safe, although slightly less efficient default

Note that I'd like to get rid of the addable1/addable2 distinction as well, just addable< T > or addable< T, U > is IMHO easier.

Daniel


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