Core: Add constexpr constructors/operators to math structs
• Begin integrating `constexpr` on math tests; use `static_assert` where appropriate
This commit is contained in:
parent
9e6ee9c5c3
commit
ea62170dac
56 changed files with 1109 additions and 1159 deletions
|
|
@ -205,8 +205,8 @@ struct [[nodiscard]] Rect2 {
|
|||
bool is_same(const Rect2 &p_rect) const;
|
||||
bool is_finite() const;
|
||||
|
||||
bool operator==(const Rect2 &p_rect) const { return position == p_rect.position && size == p_rect.size; }
|
||||
bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; }
|
||||
constexpr bool operator==(const Rect2 &p_rect) const { return position == p_rect.position && size == p_rect.size; }
|
||||
constexpr bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; }
|
||||
|
||||
inline Rect2 grow(real_t p_amount) const {
|
||||
Rect2 g = *this;
|
||||
|
|
@ -361,12 +361,12 @@ struct [[nodiscard]] Rect2 {
|
|||
operator String() const;
|
||||
operator Rect2i() const;
|
||||
|
||||
Rect2() {}
|
||||
Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) :
|
||||
Rect2() = default;
|
||||
constexpr Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) :
|
||||
position(Point2(p_x, p_y)),
|
||||
size(Size2(p_width, p_height)) {
|
||||
}
|
||||
Rect2(const Point2 &p_pos, const Size2 &p_size) :
|
||||
constexpr Rect2(const Point2 &p_pos, const Size2 &p_size) :
|
||||
position(p_pos),
|
||||
size(p_size) {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue