added const postfix at Size2<>

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-06-07 20:57:07 +08:00
parent 08da6dac6a
commit f114032e53

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include<hgl/type/DataType.h> #include<hgl/type/DataType.h>
namespace hgl namespace hgl
{ {
/** /**
* *
*/ */
template<typename T> struct Size2 template<typename T> struct Size2
{ {
@ -24,8 +24,8 @@ namespace hgl
height=h; height=h;
} }
const bool isLandscape()const{return width>height;} ///<是否横的 const bool isLandscape()const{return width>height;} ///<是否横的
const bool isPortrait()const{return width<height;} ///<是否竖的 const bool isPortrait()const{return width<height;} ///<是否竖的
void Swap() void Swap()
{ {
@ -34,7 +34,19 @@ namespace hgl
height=t; height=t;
} }
Size2<T> Swapped(){return Size2<T>(height,width);} ///<获取一个横竖交换的尺寸 Size2<T> Swapped()const{return Size2<T>(height,width);} ///<获取一个横竖交换的尺寸
const bool operator == (const Size2<T> &s) const
{
if(width!=s.width)return(false);
if(height!=s.height)return(false);
return(true);
}
const bool operator != (const Size2<T> &s) const
{
return !operator==(s);
}
};//template<typename T> struct Size2 };//template<typename T> struct Size2
using Size2i =Size2<int>; using Size2i =Size2<int>;