bwidgets/inc/basic_widgets/core/type/size.hpp

35 lines
713 B
C++

#ifndef BWIDGETS_SIZE_HPP
#define BWIDGETS_SIZE_HPP
#include <basic_widgets/core/type/concepts.hpp>
namespace bwidgets
{
struct Size
{
int w;
int h;
[[nodiscard]] inline auto operator-() const -> Size
{
return {-w, -h};
}
[[nodiscard]] inline auto operator+(const Size& s) const -> Size
{
return {w + s.w, h + s.h};
}
[[nodiscard]] inline auto operator-(const Size& s) const -> Size
{
return {w - s.w, h - s.h};
}
template<Numeric N>
[[nodiscard]] inline auto operator*(N a) const -> Size
{
return {a * w, a * h};
}
};
}
#endif