Custom binary operators

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Dec 28 08:33:18 PST 2013


On 28/12/13 16:24, Dicebot wrote:
> AFAIK it is intentionally banned to constrain operator overloading abuse.

Ahh, makes sense.  But isn't it possible to do something with templates that 
would allow for something like,

     auto a = matrix(...);
     auto b = matrix(...);

     auto c = ElementWise!("a * b");

... where the ElementWise template would ensure that the binary operation is 
applied successively to corresponding pairs of elements from the matrices?


More information about the Digitalmars-d-learn mailing list