Sfoglia il codice sorgente

feat(libstdc++): addr max and min

greatbridf 1 anno fa
parent
commit
8123051e6a
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  1. 12 0
      gblibstdc++/include/algorithm

+ 12 - 0
gblibstdc++/include/algorithm

@@ -197,6 +197,18 @@ constexpr void sort(RandomIter first, RandomIter last)
     sort(first, last, std::less<typename std::decay_t<decltype(*first)>>());
 }
 
+template <typename T>
+constexpr const T& min(const T& a, const T& b)
+{
+    return a < b ? a : b;
+}
+
+template <typename T>
+constexpr const T& max(const T& a, const T& b)
+{
+    return a > b ? a : b;
+}
+
 } // namespace std
 
 #endif