3 // Copyright (c) 2015 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
17 #include <boost/type_traits/is_floating_point.hpp>
19 #include <boost/geometry/core/access.hpp>
20 #include <boost/geometry/core/coordinate_dimension.hpp>
21 #include <boost/geometry/core/coordinate_type.hpp>
23 #include <boost/math/special_functions/fpclassify.hpp>
26 namespace boost { namespace geometry
29 #ifndef DOXYGEN_NO_DETAIL
36 static inline bool apply(T const& t)
38 return boost::math::isnan(t);
48 std::size_t N = geometry::dimension<Point>::value
50 struct has_coordinate_with_property
52 static bool apply(Point const& point)
54 return Predicate::apply(geometry::get<I>(point))
55 || has_coordinate_with_property
57 Point, Predicate, Enable, I+1, N
62 template <typename Point, typename Predicate, std::size_t I, std::size_t N>
63 struct has_coordinate_with_property<Point, Predicate, false, I, N>
65 static inline bool apply(Point const&)
71 template <typename Point, typename Predicate, std::size_t N>
72 struct has_coordinate_with_property<Point, Predicate, true, N, N>
74 static bool apply(Point const& )
81 #endif // DOXYGEN_NO_DETAIL
83 template <typename Point>
84 bool has_nan_coordinate(Point const& point)
86 return detail::has_coordinate_with_property
90 boost::is_floating_point
92 typename coordinate_type<Point>::type
97 }} // namespace boost::geometry
99 #endif // BOOST_GEOMETRY_UTIL_HAS_NAN_COORDINATE_HPP