diff --git a/TinySTL/Algorithm.h b/TinySTL/Algorithm.h index 661e5bd..412be08 100644 --- a/TinySTL/Algorithm.h +++ b/TinySTL/Algorithm.h @@ -48,6 +48,24 @@ namespace TinySTL{ } return first; } + //*********** [min] ******************** + template + const T& min(const T& a, const T& b){ + return !(b < a) ? a : b; + } + template + const T& min(const T& a, const T& b, Compare comp){ + return !comp(b, a) ? a : b; + } + //*********** [max] ******************** + template + const T& max(const T& a, const T& b){ + return (a < b) ? b : a; + } + template + const T& max(const T& a, const T& b, Compare comp){ + return (copm(a, b)) ? b : a; + } } #endif \ No newline at end of file diff --git a/TinySTL/String.h b/TinySTL/String.h index ff5ee9f..fadb0de 100644 --- a/TinySTL/String.h +++ b/TinySTL/String.h @@ -183,7 +183,7 @@ namespace TinySTL{ iterator insert_aux_filln(iterator p, size_t n, value_type c); size_type getNewCapacity(size_type len)const{ size_type oldCapacity = endOfStorage_ - start_; - auto res = std::max(oldCapacity, len); + auto res = TinySTL::max(oldCapacity, len); size_type newCapacity = (oldCapacity != 0 ? (oldCapacity + res) : 1); return newCapacity; }