Mark some common constructors and other stuff as constexpr

This commit is contained in:
sfan5
2024-03-09 22:05:06 +01:00
parent 1e89db1b80
commit a7dd075dec
11 changed files with 113 additions and 122 deletions

View File

@ -20,16 +20,16 @@ namespace core
{
public:
//! Default constructor for empty dimension
dimension2d() : Width(0), Height(0) {}
constexpr dimension2d() : Width(0), Height(0) {}
//! Constructor with width and height
dimension2d(const T& width, const T& height)
constexpr dimension2d(const T& width, const T& height)
: Width(width), Height(height) {}
dimension2d(const vector2d<T>& other); // Defined in vector2d.h
//! Use this constructor only where you are sure that the conversion is valid.
template <class U>
explicit dimension2d(const dimension2d<U>& other) :
explicit constexpr dimension2d(const dimension2d<U>& other) :
Width((T)other.Width), Height((T)other.Height) { }
template <class U>