Chatterino
Clamp.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace chatterino {
4 
5 // http://en.cppreference.com/w/cpp/algorithm/clamp
6 
7 template <class T>
8 constexpr const T &clamp(const T &v, const T &lo, const T &hi)
9 {
10  return assert(!(hi < lo)), (v < lo) ? lo : (hi < v) ? hi : v;
11 }
12 
13 } // namespace chatterino
Definition: Application.cpp:48
constexpr const T & clamp(const T &v, const T &lo, const T &hi)
Definition: Clamp.hpp:8