FTXUI  3.0.0
C++ functional terminal UI.
Loading...
Searching...
No Matches
util.hpp
Go to the documentation of this file.
1namespace ftxui {
2namespace util {
3
4// Similar to std::clamp, but allow hi to be lower than lo.
5template <class T>
6constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
7 return v < lo ? lo : hi < v ? hi : v;
8}
9
10} // namespace util
11} // namespace ftxui
12
13// Copyright 2022 Arthur Sonzogni. All rights reserved.
14// Use of this source code is governed by the MIT license that can be found in
15// the LICENSE file.
constexpr const T & clamp(const T &v, const T &lo, const T &hi)
Definition util.hpp:6