PROPOSAL: Operator overloading by static member function

Daniel Keep daniel.keep.lists at gmail.com
Sat Oct 13 09:49:39 PDT 2007



oldrev wrote:
> It's a simple way to avoid using the ugly "opAdd_r", eg:
> 
> struct Currency
> {
>   private int m_value;
> 
>   public static Currency opAdd(Currency lhs, Currency rhs) {
>     return Currency(lhs.m_value + rhs.m_value);
>   }
> }

And how are you going to overload static opAdd_r, then?

I really don't see any need for this; opAdd_r is perfectly fine.

	-- Daniel



More information about the Digitalmars-d mailing list