PROPOSAL: Operator overloading by static member function

oldrev oldrev at gmail.com
Sat Oct 13 09:44:18 PDT 2007


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);
  }
}



More information about the Digitalmars-d mailing list