]>
Commit | Line | Data |
---|---|---|
1 | // Boost.Geometry | |
2 | ||
3 | // Copyright (c) 2015 Oracle and/or its affiliates. | |
4 | ||
5 | // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle | |
6 | ||
7 | // Use, modification and distribution is subject to the Boost Software License, | |
8 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
9 | // http://www.boost.org/LICENSE_1_0.txt) | |
10 | ||
11 | #ifndef BOOST_GEOMETRY_UTIL_HAS_INFINITE_COORDINATE_HPP | |
12 | #define BOOST_GEOMETRY_UTIL_HAS_INFINITE_COORDINATE_HPP | |
13 | ||
14 | #include <boost/type_traits/is_floating_point.hpp> | |
15 | ||
16 | #include <boost/geometry/core/coordinate_type.hpp> | |
17 | #include <boost/geometry/util/has_nan_coordinate.hpp> | |
18 | #include <boost/math/special_functions/fpclassify.hpp> | |
19 | ||
20 | namespace boost { namespace geometry | |
21 | { | |
22 | ||
23 | #ifndef DOXYGEN_NO_DETAIL | |
24 | namespace detail | |
25 | { | |
26 | ||
27 | struct isinf | |
28 | { | |
29 | template <typename T> | |
30 | static inline bool apply(T const& t) | |
31 | { | |
32 | return boost::math::isinf(t); | |
33 | } | |
34 | }; | |
35 | ||
36 | } // namespace detail | |
37 | #endif // DOXYGEN_NO_DETAIL | |
38 | ||
39 | template <typename Point> | |
40 | bool has_infinite_coordinate(Point const& point) | |
41 | { | |
42 | return detail::has_coordinate_with_property | |
43 | < | |
44 | Point, | |
45 | detail::isinf, | |
46 | boost::is_floating_point | |
47 | < | |
48 | typename coordinate_type<Point>::type | |
49 | >::value | |
50 | >::apply(point); | |
51 | } | |
52 | ||
53 | }} // namespace boost::geometry | |
54 | ||
55 | #endif // BOOST_GEOMETRY_UTIL_HAS_INFINITE_COORDINATE_HPP |