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