소스 검색

Rework opBinary to avoid duplicating code

Steven Schveighoffer 1 년 전
부모
커밋
31ae45bf9b
1개의 변경된 파일1개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 7
      source/raylib/raylib_types.d

+ 1 - 7
source/raylib/raylib_types.d

@@ -99,13 +99,7 @@ struct Rectangle
 
     Rectangle opBinary(string op)(Vector2 offset) const if(op=="+" || op=="-") {
         Rectangle result = this;
-        static if (op=="+") {
-            result.x += offset.x;
-            result.y += offset.y;
-        } else static if (op=="-") {
-            result.x -= offset.x;
-            result.y -= offset.y;
-        }
+        result.opOpAssign!op(offset);
         return result;
     }
 }