mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
14 lines
271 B
C++
14 lines
271 B
C++
#pragma once
|
|
|
|
namespace chatterino {
|
|
|
|
// http://en.cppreference.com/w/cpp/algorithm/clamp
|
|
|
|
template <class T>
|
|
constexpr const T &clamp(const T &v, const T &lo, const T &hi)
|
|
{
|
|
return assert(!(hi < lo)), (v < lo) ? lo : (hi < v) ? hi : v;
|
|
}
|
|
|
|
} // namespace chatterino
|