[Boost-bugs] [Boost C++ Libraries] #8360: Multiplication operator should allow non-commutative version

Subject: [Boost-bugs] [Boost C++ Libraries] #8360: Multiplication operator should allow non-commutative version
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-01 15:47:10


#8360: Multiplication operator should allow non-commutative version
------------------------------------------------------+---------------------
 Reporter: Jaap Eldering <eldering@…> | Owner: daniel_frey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: operators
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: |
------------------------------------------------------+---------------------
 The multipliable2 template in `boost/operators.hpp` is defined with the
 `BOOST_BINARY_OPERATOR_COMMUTATIVE` macro. This macro defines
 multiplication of types T and U in both orders in terms of `T *= U`.

 This assumes that multiplication is commutative, which is not generally
 true. For example when T is a nxn matrix type with double entries and U a
 nxn matrix with integer entries, then `T *= U` makes sense, but
 `operators.hpp` would define `U * T` using `T *= U`. Since matrix
 multiplication is not commutative, this would give wrong results.

 Suggested solution: make `multipliable2` use the NONCOMMUTATIVE macro, or
 add another `multipliable2_nc` template.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8360>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC