1
// Boost.Geometry Index
3
// n-dimensional box's / point validity check
5
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
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)
11
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
12
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
14
namespace boost { namespace geometry { namespace index { namespace detail {
18
template <typename Box, size_t Dimension>
22
(0 < Dimension && Dimension <= dimension<Box>::value),
23
INVALID_DIMENSION_PARAMETER,
26
static inline bool apply(Box const& b)
28
return is_valid_box<Box, Dimension - 1>::apply(b) &&
29
( get<min_corner, Dimension - 1>(b) <= get<max_corner, Dimension - 1>(b) );
33
template <typename Box>
34
struct is_valid_box<Box, 1>
36
static inline bool apply(Box const& b)
38
return get<min_corner, 0>(b) <= get<max_corner, 0>(b);
42
template <typename Indexable, typename Tag>
47
NOT_IMPLEMENTED_FOR_THIS_INDEXABLE,
51
template <typename Indexable>
52
struct is_valid<Indexable, point_tag>
54
static inline bool apply(Indexable const&)
60
template <typename Indexable>
61
struct is_valid<Indexable, box_tag>
63
static inline bool apply(Indexable const& b)
65
return dispatch::is_valid_box<Indexable, dimension<Indexable>::value>::apply(b);
69
} // namespace dispatch
71
template <typename Indexable>
72
inline bool is_valid(Indexable const& b)
74
return dispatch::is_valid<Indexable, typename tag<Indexable>::type>::apply(b);
77
}}}} // namespace boost::geometry::index::detail
79
#endif // BOOST_GEOMETRY_DETAIL_INDEX_ALGORITHMS_IS_VALID_HPP