File indexing completed on 2025-01-18 09:35:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
0017 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
0018
0019 #include <cmath>
0020 #include <type_traits>
0021
0022 namespace boost { namespace geometry { namespace index { namespace detail
0023 {
0024
0025 template
0026 <
0027 typename T,
0028 std::enable_if_t<std::is_integral<T>::value, int> = 0
0029 >
0030 inline T diff_abs(T const& v1, T const& v2)
0031 {
0032 return v1 < v2 ? v2 - v1 : v1 - v2;
0033 }
0034
0035 template
0036 <
0037 typename T,
0038 std::enable_if_t<! std::is_integral<T>::value, int> = 0
0039 >
0040 inline T diff_abs(T const& v1, T const& v2)
0041 {
0042 return ::fabs(v1 - v2);
0043 }
0044
0045 }}}}
0046
0047 #endif