1#pragma once
2
3#include <type_traits>
4#include <algorithm>
5#include <cmath>
6
7namespace mbgl {
8namespace util {
9
10template <typename T>
11typename std::enable_if_t<std::is_integral<T>::value, T> max(T a, T b) {
12 return std::max(a, b);
13}
14
15template <typename T>
16typename std::enable_if_t<std::is_floating_point<T>::value, T> max(T a, T b) {
17 return ::fmax(x: a, y: b);
18}
19
20template <typename T, typename... Ts>
21typename std::enable_if_t<std::is_arithmetic<T>::value, T> max(T a, T b, Ts... args) {
22 return max(a, max(b, args...));
23}
24
25template <typename T>
26typename std::enable_if_t<std::is_integral<T>::value, T> min(T a, T b) {
27 return std::min(a, b);
28}
29
30template <typename T>
31typename std::enable_if_t<std::is_floating_point<T>::value, T> min(T a, T b) {
32 return ::fmin(x: a, y: b);
33}
34
35template <typename T, typename... Ts>
36typename std::enable_if_t<std::is_arithmetic<T>::value, T> min(T a, T b, Ts... args) {
37 return min(a, min(b, args...));
38}
39
40} // namespace util
41} // namespace mbgl
42

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/math/minmax.hpp