summaryrefslogtreecommitdiff
path: root/include/fud_algorithm.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fud_algorithm.hpp')
-rw-r--r--include/fud_algorithm.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/fud_algorithm.hpp b/include/fud_algorithm.hpp
index 0ad71d5..01cc5d3 100644
--- a/include/fud_algorithm.hpp
+++ b/include/fud_algorithm.hpp
@@ -27,6 +27,20 @@
namespace fud {
+template<typename T>
+concept LessThanComparable =
+ requires(T lhs, T rhs) {
+ { lhs < rhs } -> std::convertible_to<bool>;
+};
+
+template <LessThanComparable T>
+inline const T& min(const T& lhs, const T& rhs) {
+ if (lhs < rhs) {
+ return lhs;
+ }
+ return rhs;
+}
+
template <std::integral T>
class Iota {
public: