1 // Boost.Geometry Index
3 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
5 // This file was modified by Oracle on 2019.
6 // Modifications copyright (c) 2019 Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP
14 #define BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP
16 namespace boost { namespace geometry { namespace index {
20 template <typename Strategy>
21 struct translator_equals
23 template <typename EqualTo, typename Value>
24 static inline bool apply(EqualTo const& equal_to,
25 Value const& v1, Value const& v2,
26 Strategy const& strategy)
28 return equal_to(v1, v2, strategy);
33 struct translator_equals<default_strategy>
35 template <typename EqualTo, typename Value>
36 static inline bool apply(EqualTo const& equal_to,
37 Value const& v1, Value const& v2,
38 default_strategy const&)
40 return equal_to(v1, v2);
44 template <typename IndexableGetter, typename EqualTo>
46 : public IndexableGetter
49 typedef typename IndexableGetter::result_type result_type;
51 translator(IndexableGetter const& i, EqualTo const& e)
52 : IndexableGetter(i), EqualTo(e)
55 template <typename Value>
56 result_type operator()(Value const& value) const
58 return IndexableGetter::operator()(value);
61 template <typename Value, typename Strategy>
62 bool equals(Value const& v1, Value const& v2, Strategy const& strategy) const
64 return translator_equals
67 >::apply(static_cast<EqualTo const&>(*this), v1, v2, strategy);
71 template <typename IndexableGetter>
74 typedef typename IndexableGetter::result_type type;
77 template <typename IndexableGetter>
80 typedef typename boost::remove_const<
81 typename boost::remove_reference<
82 typename result_type<IndexableGetter>::type
89 }}} // namespace boost::geometry::index
91 #endif // BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP