diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/base/stl_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/third_party/base/stl_util.h b/third_party/base/stl_util.h index 96947f5e53..9c71530c12 100644 --- a/third_party/base/stl_util.h +++ b/third_party/base/stl_util.h @@ -10,6 +10,7 @@ #include <set> #include "third_party/base/numerics/safe_conversions.h" +#include "third_party/base/stl_util.h" namespace pdfium { @@ -67,6 +68,12 @@ class ScopedSetInsertion { const T m_Entry; }; +// std::clamp(), some day. +template <class T> +constexpr const T& clamp(const T& v, const T& lo, const T& hi) { + return std::min(std::max(v, lo), hi); +} + } // namespace pdfium #endif // PDFIUM_THIRD_PARTY_BASE_STL_UTIL_H_ |