Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor geometry.h changes #7475

Merged
merged 2 commits into from
Feb 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 15 additions & 29 deletions Utilities/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ struct size2_base
{
}

constexpr size2_base(const size2_base& rhs) : width{ rhs.width }, height{ rhs.height }
{
}

constexpr size2_base operator -(const size2_base& rhs) const
{
return{ width - rhs.width, height - rhs.height };
Expand Down Expand Up @@ -215,6 +211,8 @@ struct position1_base
return x == rhs;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
bool operator !=(const position1_base& rhs) const
{
return !(*this == rhs);
Expand All @@ -224,6 +222,7 @@ struct position1_base
{
return !(*this == rhs);
}
#endif

template<typename NT>
explicit operator position1_base<NT>() const
Expand All @@ -250,10 +249,6 @@ struct position2_base
{
}

constexpr position2_base(const position2_base& rhs) : x{ rhs.x }, y{ rhs.y }
{
}

constexpr bool operator >(const position2_base& rhs) const
{
return x > rhs.x && y > rhs.y;
Expand Down Expand Up @@ -388,6 +383,8 @@ struct position2_base
return x == rhs && y == rhs;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator !=(const position2_base& rhs) const
{
return !(*this == rhs);
Expand All @@ -397,6 +394,7 @@ struct position2_base
{
return !(*this == rhs);
}
#endif

template<typename NT>
explicit constexpr operator position2_base<NT>() const
Expand Down Expand Up @@ -480,6 +478,8 @@ struct position3_base
return x == rhs && y == rhs && z == rhs;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
bool operator !=(const position3_base& rhs) const
{
return !(*this == rhs);
Expand All @@ -489,6 +489,7 @@ struct position3_base
{
return !(*this == rhs);
}
#endif

template<typename NT>
explicit operator position3_base<NT>() const
Expand Down Expand Up @@ -570,6 +571,8 @@ struct position4_base
return x == rhs && y == rhs && z == rhs && w == rhs;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator !=(const position4_base& rhs) const
{
return !(*this == rhs);
Expand All @@ -579,6 +582,7 @@ struct position4_base
{
return !(*this == rhs);
}
#endif

template<typename NT>
explicit constexpr operator position4_base<NT>() const
Expand Down Expand Up @@ -606,23 +610,11 @@ struct coord_base
};

constexpr coord_base() : position{}, size{}
#ifdef _MSC_VER
//compiler error
, x{}, y{}, width{}, height{}
#endif
{
}

constexpr coord_base(const position_base<T>& position, const size2_base<T>& size)
: position{ position }, size{ size }
#ifdef _MSC_VER
, x{ position.x }, y{ position.y }, width{ size.width }, height{ size.height }
#endif
{
}

constexpr coord_base(const coord_base<T>& other)
: position{ other.position }, size{ other.size }
{
}

Expand Down Expand Up @@ -726,10 +718,13 @@ struct area_base
return x1 == rhs.x1 && x2 == rhs.x2 && y1 == rhs.y1 && y2 == rhs.y2;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const area_base& rhs) const
{
return !(*this == rhs);
}
#endif

constexpr area_base operator - (const size2_base<T>& size) const
{
Expand Down Expand Up @@ -775,15 +770,6 @@ template<typename T>
struct size3_base
{
T width, height, depth;
/*
size3_base() : width{}, height{}, depth{}
{
}

size3_base(T width, T height, T depth) : width{ width }, height{ height }, depth{ depth }
{
}
*/
};

template<typename T>
Expand Down