Chris@16
|
1 // Boost.Geometry Index
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
|
Chris@16
|
4 //
|
Chris@16
|
5 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP
|
Chris@16
|
10 #define BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP
|
Chris@16
|
11
|
Chris@16
|
12 namespace boost { namespace geometry { namespace index {
|
Chris@16
|
13
|
Chris@16
|
14 namespace detail {
|
Chris@16
|
15
|
Chris@16
|
16 template <typename IndexableGetter, typename EqualTo>
|
Chris@16
|
17 struct translator
|
Chris@16
|
18 : public IndexableGetter
|
Chris@16
|
19 , public EqualTo
|
Chris@16
|
20 {
|
Chris@16
|
21 typedef typename IndexableGetter::result_type result_type;
|
Chris@16
|
22
|
Chris@16
|
23 translator(IndexableGetter const& i, EqualTo const& e)
|
Chris@16
|
24 : IndexableGetter(i), EqualTo(e)
|
Chris@16
|
25 {}
|
Chris@16
|
26
|
Chris@16
|
27 template <typename Value>
|
Chris@16
|
28 result_type operator()(Value const& value) const
|
Chris@16
|
29 {
|
Chris@16
|
30 return IndexableGetter::operator()(value);
|
Chris@16
|
31 }
|
Chris@16
|
32
|
Chris@16
|
33 template <typename Value>
|
Chris@16
|
34 bool equals(Value const& v1, Value const& v2) const
|
Chris@16
|
35 {
|
Chris@16
|
36 return EqualTo::operator()(v1, v2);
|
Chris@16
|
37 }
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 template <typename IndexableGetter>
|
Chris@16
|
41 struct result_type
|
Chris@16
|
42 {
|
Chris@16
|
43 typedef typename IndexableGetter::result_type type;
|
Chris@16
|
44 };
|
Chris@16
|
45
|
Chris@16
|
46 template <typename IndexableGetter>
|
Chris@16
|
47 struct indexable_type
|
Chris@16
|
48 {
|
Chris@16
|
49 typedef typename boost::remove_const<
|
Chris@16
|
50 typename boost::remove_reference<
|
Chris@16
|
51 typename result_type<IndexableGetter>::type
|
Chris@16
|
52 >::type
|
Chris@16
|
53 >::type type;
|
Chris@16
|
54 };
|
Chris@16
|
55
|
Chris@16
|
56 } // namespace detail
|
Chris@16
|
57
|
Chris@16
|
58 }}} // namespace boost::geometry::index
|
Chris@16
|
59
|
Chris@16
|
60 #endif // BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP
|