3 // Copyright (c) 2015-2020 Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
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)
12 #ifndef BOOST_GEOMETRY_UTIL_HAS_NAN_COORDINATE_HPP
13 #define BOOST_GEOMETRY_UTIL_HAS_NAN_COORDINATE_HPP
16 #include <type_traits>
18 #include <boost/geometry/core/access.hpp>
19 #include <boost/geometry/core/coordinate_dimension.hpp>
20 #include <boost/geometry/core/coordinate_type.hpp>
22 #include <boost/math/special_functions/fpclassify.hpp>
25 namespace boost { namespace geometry
28 #ifndef DOXYGEN_NO_DETAIL
35 static inline bool apply(T const& t)
37 return boost::math::isnan(t);
47 std::size_t N = geometry::dimension<Point>::value
49 struct has_coordinate_with_property
51 static bool apply(Point const& point)
53 return Predicate::apply(geometry::get<I>(point))
54 || has_coordinate_with_property
56 Point, Predicate, Enable, I+1, N
61 template <typename Point, typename Predicate, std::size_t I, std::size_t N>
62 struct has_coordinate_with_property<Point, Predicate, false, I, N>
64 static inline bool apply(Point const&)
70 template <typename Point, typename Predicate, std::size_t N>
71 struct has_coordinate_with_property<Point, Predicate, true, N, N>
73 static bool apply(Point const& )
80 #endif // DOXYGEN_NO_DETAIL
82 template <typename Point>
83 bool has_nan_coordinate(Point const& point)
85 return detail::has_coordinate_with_property
89 std::is_floating_point
91 typename coordinate_type<Point>::type
96 }} // namespace boost::geometry
98 #endif // BOOST_GEOMETRY_UTIL_HAS_NAN_COORDINATE_HPP