Use std::clamp with C++17
This commit is contained in:
parent
deee52ce19
commit
ba5ddc4bcb
1 changed files with 4 additions and 0 deletions
|
@ -31,12 +31,16 @@ inline bool chars_less_insensitive(char a, char b) { return tolower(a) < tolower
|
|||
|
||||
namespace utils {
|
||||
|
||||
#ifdef HAVE_CXX17
|
||||
using std::clamp;
|
||||
#else
|
||||
// NOTE: remove once we have C++17 support and can use std::clamp
|
||||
template<typename T>
|
||||
CONSTEXPR const T& clamp(const T& value, const T& min, const T& max)
|
||||
{
|
||||
return std::max<T>(std::min<T>(value, max), min);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace detail {
|
||||
/// A struct that exists to implement a generic wrapper for std::find.
|
||||
|
|
Loading…
Add table
Reference in a new issue