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
7
namespace
ftxui
{
8
namespace
util {
9
10
// Similar to std::clamp, but allow hi to be lower than lo.
11
template
<
class
T>
12
constexpr
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 */
ftxui::util::clamp
constexpr const T & clamp(const T &v, const T &lo, const T &hi)
Definition:
util.hpp:12
ftxui
Definition:
animation.hpp:12