www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - can I overload operators as extension methods?

reply XavierAP <n3minis-git yahoo.es> writes:
The same way as T.foo() is lowered to foo(T) if no such member is 
defined inside the type. It would allow me to extend 3rd party 
types with operator notation without wrapping them.

After trying and reading the specification, looks like nuts, but 
just wanted to confirm. Thx
Mar 09 2017
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 9 March 2017 at 23:50:04 UTC, XavierAP wrote:
 The same way as T.foo() is lowered to foo(T) if no such member 
 is defined inside the type.
No. But wrapping in a struct with alias this lets you extend them pretty easily too.
Mar 09 2017