diff --git a/libs/geom/include/psemek/geom/math.hpp b/libs/geom/include/psemek/geom/math.hpp index 56aab707..89855458 100644 --- a/libs/geom/include/psemek/geom/math.hpp +++ b/libs/geom/include/psemek/geom/math.hpp @@ -171,4 +171,26 @@ namespace psemek::geom return (x / y) + ((x % y) == 0 ? 0 : 1); } + template + bool make_min(T & target, T const & source) + { + if (target > source) + { + target = source; + return true; + } + return false; + } + + template + bool make_max(T & target, T const & source) + { + if (target < source) + { + target = source; + return true; + } + return false; + } + }