Files
MapLibreParticleLab/include/mbgl/math/clamp.hpp
Tim Sylvester 705bdfb3de add noexcepts (#2119)
Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
2024-04-08 15:39:18 +00:00

17 lines
297 B
C++

#pragma once
#include <mbgl/math/minmax.hpp>
#include <type_traits>
namespace mbgl {
namespace util {
template <typename T>
auto clamp(std::enable_if_t<std::is_scalar_v<T>, T> value, T min_, T max_) noexcept {
return max(min_, min(max_, value));
}
} // namespace util
} // namespace mbgl