annotate DEPENDENCIES/generic/include/boost/geometry/index/detail/algorithms/diff_abs.hpp @ 94:12a7ba9fa2b4
Remove subrepos that require auth
author |
Chris Cannam |
date |
Tue, 21 Apr 2015 12:20:00 +0100 |
parents |
2665513ce2d3 |
children |
|
rev |
line source |
Chris@16
|
1 // Boost.Geometry Index
|
Chris@16
|
2 //
|
Chris@16
|
3 // Abs of difference
|
Chris@16
|
4 //
|
Chris@16
|
5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
|
Chris@16
|
6 //
|
Chris@16
|
7 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
|
Chris@16
|
12 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost { namespace geometry { namespace index { namespace detail {
|
Chris@16
|
15
|
Chris@16
|
16 template <typename T>
|
Chris@16
|
17 inline T diff_abs_dispatch(T const& v1, T const& v2, boost::mpl::bool_<true> const& /*is_integral*/)
|
Chris@16
|
18 {
|
Chris@16
|
19 return v1 < v2 ? v2 - v1 : v1 - v2;
|
Chris@16
|
20 }
|
Chris@16
|
21
|
Chris@16
|
22 template <typename T>
|
Chris@16
|
23 inline T diff_abs_dispatch(T const& v1, T const& v2, boost::mpl::bool_<false> const& /*is_integral*/)
|
Chris@16
|
24 {
|
Chris@16
|
25 return ::fabs(v1 - v2);
|
Chris@16
|
26 }
|
Chris@16
|
27
|
Chris@16
|
28 template <typename T>
|
Chris@16
|
29 inline T diff_abs(T const& v1, T const& v2)
|
Chris@16
|
30 {
|
Chris@16
|
31 typedef boost::mpl::bool_<
|
Chris@16
|
32 boost::is_integral<T>::value
|
Chris@16
|
33 > is_integral;
|
Chris@16
|
34 return diff_abs_dispatch(v1, v2, is_integral());
|
Chris@16
|
35 }
|
Chris@16
|
36
|
Chris@16
|
37 }}}} // namespace boost::geometry::index::detail
|
Chris@16
|
38
|
Chris@16
|
39 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
|