diff options
Diffstat (limited to 'include/fud_algorithm.hpp')
-rw-r--r-- | include/fud_algorithm.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/fud_algorithm.hpp b/include/fud_algorithm.hpp index 01cc5d3..82e98cb 100644 --- a/include/fud_algorithm.hpp +++ b/include/fud_algorithm.hpp @@ -23,7 +23,6 @@ #include <concepts> #include <limits> -#include <type_traits> namespace fud { @@ -36,11 +35,23 @@ concept LessThanComparable = template <LessThanComparable T> inline const T& min(const T& lhs, const T& rhs) { if (lhs < rhs) { + // NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter) return lhs; } + // NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter) return rhs; } +template <LessThanComparable T> +inline const T& max(const T& lhs, const T& rhs) { + if (lhs < rhs) { + // NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter) + return rhs; + } + // NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter) + return lhs; +} + template <std::integral T> class Iota { public: |