Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:44

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_DISTANCE_COMPARABLE_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_DISTANCE_COMPARABLE_HPP
0012 
0013 
0014 #include <boost/geometry/core/cs.hpp>
0015 #include <boost/geometry/core/static_assert.hpp>
0016 
0017 #include <boost/geometry/strategies/distance.hpp>
0018 
0019 
0020 namespace boost { namespace geometry
0021 {
0022 
0023 namespace strategies { namespace distance
0024 {
0025 
0026 #ifndef DOXYGEN_NO_DETAIL
0027 namespace detail
0028 {
0029 
0030 template <typename Strategies>
0031 struct comparable
0032     : public Strategies
0033 {
0034     comparable() = default;
0035 
0036     explicit comparable(Strategies const& strategies)
0037         : Strategies(strategies)
0038     {}
0039 
0040     template <typename Geometry1, typename Geometry2>
0041     auto distance(Geometry1 const& g1, Geometry2 const& g2) const
0042     {
0043         return strategy::distance::services::get_comparable
0044             <
0045                 decltype(Strategies::distance(g1, g2))
0046             >::apply(Strategies::distance(g1, g2));
0047     }
0048 };
0049 
0050 template <typename Strategies>
0051 inline comparable<Strategies> make_comparable(Strategies const& strategies)
0052 {
0053     return comparable<Strategies>(strategies);
0054 }
0055 
0056 } // namespace detail
0057 #endif // DOXYGEN_NO_DETAIL
0058 
0059 }} // namespace strategies::distance
0060 
0061 }} // namespace boost::geometry
0062 
0063 #endif // BOOST_GEOMETRY_STRATEGIES_DISTANCE_COMPARABLE_HPP