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