FTXUI  5.0.0
C++ functional terminal UI.
Loading...
Searching...
No Matches
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::util {
8
9// Similar to std::clamp, but allow hi to be lower than lo.
10template <class T>
11constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
12 return v < lo ? lo : hi < v ? hi : v;
13}
14
15} // namespace ftxui::util
16
17#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:11
std::shared_ptr< T > Make(Args &&... args)
Definition component.hpp:26