// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2014-2015, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_STRATEGIES_COMPARABLE_DISTANCE_RESULT_HPP #define BOOST_GEOMETRY_STRATEGIES_COMPARABLE_DISTANCE_RESULT_HPP #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { namespace resolve_strategy { template struct comparable_distance_result : strategy::distance::services::return_type < typename strategy::distance::services::comparable_type < Strategy >::type, typename point_type::type, typename point_type::type > {}; template struct comparable_distance_result : comparable_distance_result < Geometry1, Geometry2, typename detail::distance::default_strategy < Geometry1, Geometry2 >::type > {}; } // namespace resolve_strategy namespace resolve_variant { template struct comparable_distance_result : resolve_strategy::comparable_distance_result < Geometry1, Geometry2, Strategy > {}; template < typename Geometry1, BOOST_VARIANT_ENUM_PARAMS(typename T), typename Strategy > struct comparable_distance_result < Geometry1, boost::variant, Strategy > { // A set of all variant type combinations that are compatible and // implemented typedef typename util::combine_if< typename boost::mpl::vector1, typename boost::variant::types, boost::mpl::always >::type possible_input_types; // The (possibly variant) result type resulting from these combinations typedef typename compress_variant< typename transform_variant< possible_input_types, resolve_strategy::comparable_distance_result< boost::mpl::first, boost::mpl::second, Strategy >, boost::mpl::back_inserter > >::type >::type type; }; // Distance arguments are commutative template < BOOST_VARIANT_ENUM_PARAMS(typename T), typename Geometry2, typename Strategy > struct comparable_distance_result < boost::variant, Geometry2, Strategy > : public comparable_distance_result < Geometry2, boost::variant, Strategy > {}; template struct comparable_distance_result < boost::variant, boost::variant, Strategy > { // A set of all variant type combinations that are compatible and // implemented typedef typename util::combine_if < typename boost::variant::types, typename boost::variant::types, boost::mpl::always >::type possible_input_types; // The (possibly variant) result type resulting from these combinations typedef typename compress_variant< typename transform_variant< possible_input_types, resolve_strategy::comparable_distance_result< boost::mpl::first, boost::mpl::second, Strategy >, boost::mpl::back_inserter > >::type >::type type; }; } // namespace resolve_variant /*! \brief Meta-function defining return type of comparable_distance function \ingroup distance */ template < typename Geometry1, typename Geometry2 = Geometry1, typename Strategy = void > struct comparable_distance_result : resolve_variant::comparable_distance_result < Geometry1, Geometry2, Strategy > {}; template struct comparable_distance_result : comparable_distance_result {}; }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_COMPARABLE_DISTANCE_RESULT_HPP