On 23.04.2013, at 19:45, Andrew Ho
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