1 // Boost.Geometry Index
3 // Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query
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_SMALLEST_FOR_INDEXABLE_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP
14 namespace boost { namespace geometry { namespace index { namespace detail {
19 typename IndexableTag,
21 size_t DimensionIndex>
22 struct smallest_for_indexable_dimension
26 NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE,
27 (smallest_for_indexable_dimension));
33 typename IndexableTag,
36 struct smallest_for_indexable
38 typedef typename smallest_for_indexable_dimension<
39 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
40 >::result_type result_type;
42 template <typename Data>
43 inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
45 result_type r1 = smallest_for_indexable<
46 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
49 result_type r2 = smallest_for_indexable_dimension<
50 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
53 return r1 < r2 ? r1 : r2;
60 typename IndexableTag,
62 struct smallest_for_indexable<Geometry, Indexable, IndexableTag, AlgoTag, 1>
64 typedef typename smallest_for_indexable_dimension<
65 Geometry, Indexable, IndexableTag, AlgoTag, 0
66 >::result_type result_type;
68 template <typename Data>
69 inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
72 smallest_for_indexable_dimension<
73 Geometry, Indexable, IndexableTag, AlgoTag, 0
78 }}}} // namespace boost::geometry::index::detail
80 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP