Sfoglia il codice sorgente

common/math_util: Make Rectangle's constructors constexpr

Allows objects that contain rectangle instances to be constexpr
constructible as well.
Lioncash 7 anni fa
parent
commit
f11173f88c
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      src/common/math_util.h

+ 2 - 2
src/common/math_util.h

@@ -18,9 +18,9 @@ struct Rectangle {
     T right{};
     T right{};
     T bottom{};
     T bottom{};
 
 
-    Rectangle() = default;
+    constexpr Rectangle() = default;
 
 
-    Rectangle(T left, T top, T right, T bottom)
+    constexpr Rectangle(T left, T top, T right, T bottom)
         : left(left), top(top), right(right), bottom(bottom) {}
         : left(left), top(top), right(right), bottom(bottom) {}
 
 
     T GetWidth() const {
     T GetWidth() const {