Add geom::make_min & make_max

This commit is contained in:
Nikita Lisitsa 2022-03-16 16:23:57 +03:00
parent e8a5ecfa3b
commit afbf49950f

View file

@ -171,4 +171,26 @@ namespace psemek::geom
return (x / y) + ((x % y) == 0 ? 0 : 1);
}
template <typename T>
bool make_min(T & target, T const & source)
{
if (target > source)
{
target = source;
return true;
}
return false;
}
template <typename T>
bool make_max(T & target, T const & source)
{
if (target < source)
{
target = source;
return true;
}
return false;
}
}