On 04/29/2015 04:16 PM, Ali Çehreli wrote:

     ref CustomInteger opOpAssign(string op, T2)(T2 rhs)
     {
         static if (is (T2 == CustomInteger)) {
             mixin("value_ " ~ op ~ "= rhs.value_;");
             return this;

         } else {
             return this.opOpAssign!(op,
CustomInteger)(CustomInteger(rhs));

Playing a little more, the following shorter equivalent of the last line works as well:

    return opOpAssign!op(CustomInteger(rhs));

Ali

Reply via email to