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

35 lines
659 B
C++

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