summaryrefslogtreecommitdiff
path: root/include/mbgl/math/clamp.hpp
blob: 38d430547d939d94545c752244df00dbf5a483b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once

#include <mbgl/math/minmax.hpp>

namespace mbgl {
namespace util {

template <typename T>
T clamp(T value, T min_, T max_) {
    return max(min_, min(max_, value));
}

} // namespace util
} // namespace mbgl