digitalmars.D.learn - Legal operator overloading
- Nicholas Wilson (6/6) May 29 2016 Is it legal/possible to overload the unary * operator? Also is it
- Mike Parker (5/8) May 29 2016 Yes to unary * (see [1]). No to the rest. Comparisons are always
Is it legal/possible to overload the unary * operator? Also is it legal/possible to individually overload the comparison operators and not return a bool? (Before you ask no I'm not crazy, I am trying to make a library solution to multiple address spaces for supporting OpenCL/CUDA in D, and vector comparisons.)
May 29 2016
On Monday, 30 May 2016 at 05:54:42 UTC, Nicholas Wilson wrote:Is it legal/possible to overload the unary * operator? Also is it legal/possible to individually overload the comparison operators and not return a bool?Yes to unary * (see [1]). No to the rest. Comparisons are always lowered to opEquals or opCmp by the compiler as per [2]. [1] https://dlang.org/spec/operatoroverloading.html#unary [2] https://dlang.org/spec/operatoroverloading.html#eqcmp
May 29 2016