From 18d86e8b730f39660bea41c8e30b6df92293433f Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Mon, 7 Oct 2024 20:03:28 +0200 Subject: [PATCH] feat: use tag_cast_t more and extract primary_single_tag --- include/boost/geometry/algorithms/convert.hpp | 1 + .../detail/buffer/buffer_inserter.hpp | 10 +--- .../centroid/translating_transformer.hpp | 13 ++--- .../detail/disjoint/linear_areal.hpp | 4 +- .../detail/envelope/range_of_boxes.hpp | 2 +- .../detail/equals/collect_vectors.hpp | 2 +- .../algorithms/detail/equals/interface.hpp | 8 +-- .../algorithms/detail/extreme_points.hpp | 6 +- .../algorithms/detail/for_each_range.hpp | 1 - .../algorithms/detail/overlay/get_turns.hpp | 3 +- .../detail/overlay/intersection_insert.hpp | 15 ++--- .../detail/sections/section_functions.hpp | 7 +-- .../detail/sections/sectionalize.hpp | 11 ++-- .../algorithms/detail/touches/interface.hpp | 8 +-- .../algorithms/detail/tupled_output.hpp | 27 +-------- .../algorithms/detail/within/multi_point.hpp | 1 - .../boost/geometry/algorithms/difference.hpp | 18 ++---- .../algorithms/dispatch/closest_points.hpp | 12 ++-- .../geometry/algorithms/dispatch/disjoint.hpp | 12 ++-- .../geometry/algorithms/dispatch/distance.hpp | 12 ++-- .../boost/geometry/algorithms/for_each.hpp | 2 +- .../geometry/algorithms/num_geometries.hpp | 7 +-- .../boost/geometry/algorithms/num_points.hpp | 5 +- .../geometry/algorithms/point_on_surface.hpp | 6 +- .../geometry/algorithms/remove_spikes.hpp | 6 +- .../geometry/algorithms/sym_difference.hpp | 22 ++++---- .../boost/geometry/algorithms/transform.hpp | 8 +-- include/boost/geometry/algorithms/union.hpp | 27 ++++----- .../geometry/core/primary_single_tag.hpp | 55 +++++++++++++++++++ include/boost/geometry/core/tag_cast.hpp | 1 - .../geometry/geometries/helper_geometry.hpp | 2 +- include/boost/geometry/io/dsv/write.hpp | 6 +- include/boost/geometry/io/svg/svg_mapper.hpp | 6 +- .../strategies/agnostic/point_in_point.hpp | 2 +- .../point_in_poly_oriented_winding.hpp | 6 +- .../agnostic/point_in_poly_winding.hpp | 13 +---- include/boost/geometry/strategies/compare.hpp | 4 +- .../strategies/concepts/within_concept.hpp | 6 +- .../boost/geometry/strategies/convex_hull.hpp | 2 +- .../boost/geometry/strategies/covered_by.hpp | 24 ++++---- .../boost/geometry/strategies/disjoint.hpp | 8 +-- .../boost/geometry/strategies/distance.hpp | 4 +- .../boost/geometry/strategies/normalize.hpp | 12 +--- include/boost/geometry/strategies/within.hpp | 28 +++++----- include/boost/geometry/strategy/relate.hpp | 5 +- .../strategy/spherical/envelope_segment.hpp | 2 +- .../strategy/spherical/expand_point.hpp | 2 +- .../distance/distance_brute_force.hpp | 14 +---- test/util/is_implemented.cpp | 4 +- 49 files changed, 214 insertions(+), 248 deletions(-) create mode 100644 include/boost/geometry/core/primary_single_tag.hpp diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp index 53db232f7e..26335ec3d1 100644 --- a/include/boost/geometry/algorithms/convert.hpp +++ b/include/boost/geometry/algorithms/convert.hpp @@ -40,6 +40,7 @@ #include #include +#include #include #include diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp index 6e5782b6ef..01812e3622 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -177,8 +178,7 @@ struct buffer_range output_point_type const& p1, output_point_type const& p2) { - typedef typename cs_tag::type cs_tag; - return direction_code(p0, p1, p2) == 1; + return direction_code>(p0, p1, p2) == 1; } template @@ -929,11 +929,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator dispatch::buffer_inserter < - typename tag_cast - < - typename tag::type, - multi_tag - >::type, + tag_cast_t, multi_tag>, GeometryInput, GeometryOutput >::apply(geometry_input, collection, diff --git a/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp b/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp index 042891e6e2..6baf19078b 100644 --- a/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp +++ b/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp @@ -45,13 +45,12 @@ namespace detail { namespace centroid // cartesian. But if it was needed then one should translate using // CS-specific technique, e.g. in spherical/geographic a translation // vector should contain coordinates being multiplies of 2PI or 360 deg. -template ::type, - areal_tag - >::type, - typename CSTag = typename cs_tag::type> +template +< + typename Geometry, + typename CastedTag = tag_cast_t, areal_tag>, + typename CSTag = cs_tag_t +> struct translating_transformer { typedef typename geometry::point_type::type point_type; diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp index 8d71dd2e34..7558284c60 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp @@ -61,8 +61,8 @@ namespace detail { namespace disjoint { template ::type, - typename Tag1OrMulti = typename tag_cast::type> + typename Tag1 = tag_t, + typename Tag1OrMulti = tag_cast_t> struct disjoint_no_intersections_policy { /*! diff --git a/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp b/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp index d22d9f5467..2fa922705e 100644 --- a/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp @@ -235,7 +235,7 @@ struct envelope_range_of_boxes static const bool is_equatorial = ! std::is_same < - typename cs_tag::type, + cs_tag_t, spherical_polar_tag >::value; diff --git a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp index f74cbd8b3b..7c70b30f82 100644 --- a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp +++ b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp @@ -334,7 +334,7 @@ struct range_collect_vectors // Default version (cartesian) -template ::type> +template > struct box_collect_vectors { // Calculate on coordinate type, but if it is integer, diff --git a/include/boost/geometry/algorithms/detail/equals/interface.hpp b/include/boost/geometry/algorithms/detail/equals/interface.hpp index f0c4438430..5590a8d88f 100644 --- a/include/boost/geometry/algorithms/detail/equals/interface.hpp +++ b/include/boost/geometry/algorithms/detail/equals/interface.hpp @@ -49,10 +49,10 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type, - typename CastedTag1 = typename tag_cast::type, - typename CastedTag2 = typename tag_cast::type, + typename Tag1 = tag_t, + typename Tag2 = tag_t, + typename CastedTag1 = tag_cast_t, + typename CastedTag2 = tag_cast_t, std::size_t DimensionCount = dimension::type::value, bool Reverse = reverse_dispatch::type::value > diff --git a/include/boost/geometry/algorithms/detail/extreme_points.hpp b/include/boost/geometry/algorithms/detail/extreme_points.hpp index 2ac13fc1ed..f3845c9204 100644 --- a/include/boost/geometry/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/algorithms/detail/extreme_points.hpp @@ -546,10 +546,10 @@ inline bool extreme_points(Geometry const& geometry, Extremes& extremes, Intruders& intruders) { - typedef typename strategy::side::services::default_strategy + using strategy_type = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type strategy_type; + cs_tag_t + >::type; return geometry::extreme_points(geometry,extremes, intruders, strategy_type()); } diff --git a/include/boost/geometry/algorithms/detail/for_each_range.hpp b/include/boost/geometry/algorithms/detail/for_each_range.hpp index 0691700044..30b209dc62 100644 --- a/include/boost/geometry/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/algorithms/detail/for_each_range.hpp @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index e63f0dfda5..b8cb1ea015 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -811,7 +812,7 @@ struct get_turns_multi_polygon_cs template struct topological_tag_base { - typedef typename tag_cast::type, pointlike_tag, linear_tag, areal_tag>::type type; + using type = tag_cast_t, pointlike_tag, linear_tag, areal_tag>; }; template #include #include +#include #include @@ -504,13 +505,13 @@ template bool Reverse1 = detail::overlay::do_reverse::value>::value, bool Reverse2 = detail::overlay::do_reverse::value>::value, // tag dispatching: - typename TagIn1 = typename geometry::tag::type, - typename TagIn2 = typename geometry::tag::type, + typename TagIn1 = tag_t, + typename TagIn2 = tag_t, typename TagOut = typename detail::setop_insert_output_tag::type, // metafunction finetuning helpers: - typename CastedTagIn1 = typename geometry::tag_cast::type, - typename CastedTagIn2 = typename geometry::tag_cast::type, - typename CastedTagOut = typename geometry::tag_cast::type + typename CastedTagIn1 = tag_cast_t, + typename CastedTagIn2 = tag_cast_t, + typename CastedTagOut = tag_cast_t > struct intersection_insert { @@ -1064,7 +1065,7 @@ struct intersection_insert > : detail_dispatch::overlay::pointlike_linear_point < Point, Linear, PointOut, OverlayType, - point_tag, typename tag_cast::type + point_tag, tag_cast_t > {}; @@ -1086,7 +1087,7 @@ struct intersection_insert < MultiPoint, Linear, PointOut, OverlayType, multi_point_tag, - typename tag_cast::type + tag_cast_t > {}; diff --git a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp index ab799d5a48..d91ce7633e 100644 --- a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp +++ b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp @@ -16,6 +16,7 @@ #include #include +#include // For spherical/geographic longitudes covered_by point/box #include @@ -36,11 +37,7 @@ template < std::size_t Dimension, typename Geometry, - typename CastedCSTag = typename tag_cast - < - typename cs_tag::type, - spherical_tag - >::type + typename CastedCSTag = tag_cast_t, spherical_tag> > struct preceding_check { diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 8b53822b07..7b36ec4778 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -148,11 +149,7 @@ template typename DimensionVector, std::size_t Index, std::size_t Count, - typename CastedCSTag = typename tag_cast - < - typename cs_tag::type, - spherical_tag - >::type + typename CastedCSTag = tag_cast_t, spherical_tag> > struct get_direction_loop { @@ -497,14 +494,14 @@ struct sectionalize_part // In cartesian this is envelope of previous point expanded with current point // in non-cartesian this is envelope of a segment - box_first_in_section::type> + box_first_in_section> ::apply(section.bounding_box, previous_point, current_point, strategy); } else { // In cartesian this is expand with current point // in non-cartesian this is expand with a segment - box_next_in_section::type> + box_next_in_section> ::apply(section.bounding_box, previous_point, current_point, strategy); } diff --git a/include/boost/geometry/algorithms/detail/touches/interface.hpp b/include/boost/geometry/algorithms/detail/touches/interface.hpp index 271697c5d9..b7f6f10b1c 100644 --- a/include/boost/geometry/algorithms/detail/touches/interface.hpp +++ b/include/boost/geometry/algorithms/detail/touches/interface.hpp @@ -49,10 +49,10 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type, - typename CastedTag1 = typename tag_cast::type, - typename CastedTag2 = typename tag_cast::type, + typename Tag1 = tag_t, + typename Tag2 = tag_t, + typename CastedTag1 = tag_cast_t, + typename CastedTag2 = tag_cast_t, bool Reverse = reverse_dispatch::type::value > struct touches diff --git a/include/boost/geometry/algorithms/detail/tupled_output.hpp b/include/boost/geometry/algorithms/detail/tupled_output.hpp index 8d9652683a..d13793e737 100644 --- a/include/boost/geometry/algorithms/detail/tupled_output.hpp +++ b/include/boost/geometry/algorithms/detail/tupled_output.hpp @@ -520,10 +520,10 @@ struct expect_output_assert TupledOut, is_tag_same_as_pred::template pred >::value, - typename geometry::tag_cast + tag_cast_t < Tag, pointlike_tag, linear_tag, areal_tag - >::type + > > {}; @@ -540,29 +540,6 @@ struct expect_output : expect_output_assert... {}; - -template -struct single_tag_from_base_tag; - -template <> -struct single_tag_from_base_tag -{ - typedef point_tag type; -}; - -template <> -struct single_tag_from_base_tag -{ - typedef linestring_tag type; -}; - -template <> -struct single_tag_from_base_tag -{ - typedef polygon_tag type; -}; - - template < typename Geometry, diff --git a/include/boost/geometry/algorithms/detail/within/multi_point.hpp b/include/boost/geometry/algorithms/detail/within/multi_point.hpp index 559d89d028..42e121b42c 100644 --- a/include/boost/geometry/algorithms/detail/within/multi_point.hpp +++ b/include/boost/geometry/algorithms/detail/within/multi_point.hpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/difference.hpp b/include/boost/geometry/algorithms/difference.hpp index 096c06ab6f..2d18b31421 100644 --- a/include/boost/geometry/algorithms/difference.hpp +++ b/include/boost/geometry/algorithms/difference.hpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include // For backward compatibility #include #include @@ -106,14 +108,10 @@ template > struct call_intersection_insert_tupled_base { - typedef typename geometry::detail::single_tag_from_base_tag + using single_tag = primary_single_tag_t < - typename geometry::tag_cast - < - typename geometry::tag::type, - pointlike_tag, linear_tag, areal_tag - >::type - >::type single_tag; + tag_cast_t, pointlike_tag, linear_tag, areal_tag> + >; typedef detail::expect_output < @@ -283,11 +281,7 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1, template < typename Geometry, typename Collection, - typename CastedTag = typename geometry::tag_cast - < - typename geometry::tag::type, - pointlike_tag, linear_tag, areal_tag - >::type + typename CastedTag = tag_cast_t, pointlike_tag, linear_tag, areal_tag> > struct multi_output_type { diff --git a/include/boost/geometry/algorithms/dispatch/closest_points.hpp b/include/boost/geometry/algorithms/dispatch/closest_points.hpp index e4f72de66a..c803316dde 100644 --- a/include/boost/geometry/algorithms/dispatch/closest_points.hpp +++ b/include/boost/geometry/algorithms/dispatch/closest_points.hpp @@ -34,22 +34,22 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag_cast + typename Tag1 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, - typename Tag2 = typename tag_cast + >, + typename Tag2 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, + >, bool Reverse = reverse_dispatch::type::value > struct closest_points : not_implemented diff --git a/include/boost/geometry/algorithms/dispatch/disjoint.hpp b/include/boost/geometry/algorithms/dispatch/disjoint.hpp index ef74991883..897ef9918b 100644 --- a/include/boost/geometry/algorithms/dispatch/disjoint.hpp +++ b/include/boost/geometry/algorithms/dispatch/disjoint.hpp @@ -45,16 +45,16 @@ template < typename Geometry1, typename Geometry2, std::size_t DimensionCount = dimension::type::value, - typename Tag1 = typename tag_cast + typename Tag1 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, - typename Tag2 = typename tag_cast + >, + typename Tag2 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, + >, bool Reverse = reverse_dispatch::type::value > struct disjoint diff --git a/include/boost/geometry/algorithms/dispatch/distance.hpp b/include/boost/geometry/algorithms/dispatch/distance.hpp index eb9cd92f66..9272fd496b 100644 --- a/include/boost/geometry/algorithms/dispatch/distance.hpp +++ b/include/boost/geometry/algorithms/dispatch/distance.hpp @@ -98,22 +98,22 @@ template < Geometry1, Geometry2 >::type, - typename Tag1 = typename tag_cast + typename Tag1 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, - typename Tag2 = typename tag_cast + >, + typename Tag2 = tag_cast_t < - typename tag::type, + tag_t, segment_tag, box_tag, linear_tag, areal_tag - >::type, + >, typename StrategyTag = typename distance_strategy_tag < Geometry1, Geometry2, Strategy diff --git a/include/boost/geometry/algorithms/for_each.hpp b/include/boost/geometry/algorithms/for_each.hpp index d03643ab1b..56636e31a9 100644 --- a/include/boost/geometry/algorithms/for_each.hpp +++ b/include/boost/geometry/algorithms/for_each.hpp @@ -369,7 +369,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag_cast::type, multi_tag>::type + typename Tag = tag_cast_t, multi_tag> > struct for_each_point: not_implemented {}; diff --git a/include/boost/geometry/algorithms/num_geometries.hpp b/include/boost/geometry/algorithms/num_geometries.hpp index 2fc24428cb..1609dee1d6 100644 --- a/include/boost/geometry/algorithms/num_geometries.hpp +++ b/include/boost/geometry/algorithms/num_geometries.hpp @@ -51,12 +51,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag_cast - < - typename tag::type, - single_tag, - multi_tag - >::type + typename Tag = tag_cast_t, single_tag, multi_tag> > struct num_geometries: not_implemented {}; diff --git a/include/boost/geometry/algorithms/num_points.hpp b/include/boost/geometry/algorithms/num_points.hpp index ee1609dc71..6a59c2bb5a 100644 --- a/include/boost/geometry/algorithms/num_points.hpp +++ b/include/boost/geometry/algorithms/num_points.hpp @@ -86,10 +86,7 @@ template < typename Geometry, bool AddForOpen, - typename Tag = typename tag_cast - < - typename tag::type, multi_tag - >::type + typename Tag = tag_cast_t, multi_tag> > struct num_points: not_implemented {}; diff --git a/include/boost/geometry/algorithms/point_on_surface.hpp b/include/boost/geometry/algorithms/point_on_surface.hpp index 5b90db472a..88077bcc22 100644 --- a/include/boost/geometry/algorithms/point_on_surface.hpp +++ b/include/boost/geometry/algorithms/point_on_surface.hpp @@ -310,10 +310,10 @@ inline void point_on_surface(Geometry const& geometry, Point & point, template inline void point_on_surface(Geometry const& geometry, Point & point) { - typedef typename strategy::side::services::default_strategy + using strategy_type = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type strategy_type; + cs_tag_t + >::type; point_on_surface(geometry, point, strategy_type()); } diff --git a/include/boost/geometry/algorithms/remove_spikes.hpp b/include/boost/geometry/algorithms/remove_spikes.hpp index 9d50c60fcd..889fc300b4 100644 --- a/include/boost/geometry/algorithms/remove_spikes.hpp +++ b/include/boost/geometry/algorithms/remove_spikes.hpp @@ -258,10 +258,10 @@ struct remove_spikes static void apply(Geometry& geometry, geometry::default_strategy const&) { - typedef typename strategy::side::services::default_strategy + using side_strategy = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type side_strategy; + cs_tag_t + >::type; apply(geometry, side_strategy()); } diff --git a/include/boost/geometry/algorithms/sym_difference.hpp b/include/boost/geometry/algorithms/sym_difference.hpp index 19cbaef13a..b550750064 100644 --- a/include/boost/geometry/algorithms/sym_difference.hpp +++ b/include/boost/geometry/algorithms/sym_difference.hpp @@ -18,6 +18,8 @@ #include +#include +#include #include #include #include @@ -268,14 +270,14 @@ template typename Geometry1, typename Geometry2, typename GeometryOut, - typename TagIn1 = typename geometry::tag_cast + typename TagIn1 = tag_cast_t < - typename tag::type, pointlike_tag, linear_tag, areal_tag - >::type, - typename TagIn2 = typename geometry::tag_cast + tag_t, pointlike_tag, linear_tag, areal_tag + >, + typename TagIn2 = tag_cast_t < - typename tag::type, pointlike_tag, linear_tag, areal_tag - >::type, + tag_t, pointlike_tag, linear_tag, areal_tag + >, typename TagOut = typename detail::setop_insert_output_tag::type > struct sym_difference_insert @@ -380,15 +382,11 @@ struct sym_difference_insert > : detail::expect_output < - Geometry1, Geometry2, GeometryOut, - typename detail::single_tag_from_base_tag::type, - typename detail::single_tag_from_base_tag::type + Geometry1, Geometry2, GeometryOut, primary_single_tag_t, primary_single_tag_t > , detail::sym_difference::sym_difference_different_inputs_tupled_output < - GeometryOut, - typename detail::single_tag_from_base_tag::type, - typename detail::single_tag_from_base_tag::type + GeometryOut, primary_single_tag_t, primary_single_tag_t > {}; diff --git a/include/boost/geometry/algorithms/transform.hpp b/include/boost/geometry/algorithms/transform.hpp index 66d56d7143..4ce767cbc2 100644 --- a/include/boost/geometry/algorithms/transform.hpp +++ b/include/boost/geometry/algorithms/transform.hpp @@ -203,8 +203,8 @@ struct select_strategy { typedef typename strategy::transform::services::default_strategy < - typename cs_tag::type, - typename cs_tag::type, + cs_tag_t, + cs_tag_t, typename coordinate_system::type, typename coordinate_system::type, dimension::type::value, @@ -268,8 +268,8 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag_cast::type, multi_tag>::type, - typename Tag2 = typename tag_cast::type, multi_tag>::type + typename Tag1 = tag_cast_t, multi_tag>, + typename Tag2 = tag_cast_t, multi_tag> > struct transform {}; diff --git a/include/boost/geometry/algorithms/union.hpp b/include/boost/geometry/algorithms/union.hpp index 2c517d9b6f..3deced91d9 100644 --- a/include/boost/geometry/algorithms/union.hpp +++ b/include/boost/geometry/algorithms/union.hpp @@ -24,7 +24,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -47,12 +49,12 @@ namespace dispatch template < typename Geometry1, typename Geometry2, typename GeometryOut, - typename TagIn1 = typename tag::type, - typename TagIn2 = typename tag::type, + typename TagIn1 = tag_t, + typename TagIn2 = tag_t, typename TagOut = typename detail::setop_insert_output_tag::type, - typename CastedTagIn1 = typename geometry::tag_cast::type, - typename CastedTagIn2 = typename geometry::tag_cast::type, - typename CastedTagOut = typename geometry::tag_cast::type, + typename CastedTagIn1 = tag_cast_t, + typename CastedTagIn2 = tag_cast_t, + typename CastedTagOut = tag_cast_t, bool Reverse = geometry::reverse_dispatch::type::value > struct union_insert: not_implemented @@ -164,10 +166,7 @@ struct union_insert false > { - using single_tag = typename geometry::detail::single_tag_from_base_tag - < - CastedTagIn - >::type; + using single_tag = primary_single_tag_t; using expect_check = detail::expect_output < @@ -278,20 +277,14 @@ struct union_insert false > { - using single_tag1 = typename geometry::detail::single_tag_from_base_tag - < - CastedTagIn1 - >::type; + using single_tag1 = primary_single_tag_t; using expect_check1 = detail::expect_output < Geometry1, Geometry2, SingleTupledOut, single_tag1 >; - using single_tag2 = typename geometry::detail::single_tag_from_base_tag - < - CastedTagIn2 - >::type; + using single_tag2 = primary_single_tag_t; using expect_check2 = detail::expect_output < diff --git a/include/boost/geometry/core/primary_single_tag.hpp b/include/boost/geometry/core/primary_single_tag.hpp new file mode 100644 index 0000000000..4fc23c6bfa --- /dev/null +++ b/include/boost/geometry/core/primary_single_tag.hpp @@ -0,0 +1,55 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2024-2024 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP +#define BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP + +#include + +namespace boost { namespace geometry +{ + +/*! +\brief Metafunction defining a type being the primary tag + (point, linestring, polygon) of the tag related to its topological dimension. +\details pointlike_tag will be casted to point_tag, linear_tag to linestring_tag, + areal_tag to polygon_tag. +\ingroup core +\tparam Tag The tag to get the canonical tag from +*/ +template +struct primary_single_tag +{ + +}; + +template <> +struct primary_single_tag +{ + using type = point_tag; +}; + +template <> +struct primary_single_tag +{ + using type = linestring_tag; +}; + +template <> +struct primary_single_tag +{ + using type = polygon_tag; +}; + +template +using primary_single_tag_t = typename primary_single_tag::type; + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_PRIMARY_SINGLE_TAG_HPP diff --git a/include/boost/geometry/core/tag_cast.hpp b/include/boost/geometry/core/tag_cast.hpp index 58dd9912a8..2a1eb19a2c 100644 --- a/include/boost/geometry/core/tag_cast.hpp +++ b/include/boost/geometry/core/tag_cast.hpp @@ -66,7 +66,6 @@ struct tag_cast template using tag_cast_t = typename tag_cast::type; - }} // namespace boost::geometry #endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP diff --git a/include/boost/geometry/geometries/helper_geometry.hpp b/include/boost/geometry/geometries/helper_geometry.hpp index 881f143dd4..ee8c2e56b1 100644 --- a/include/boost/geometry/geometries/helper_geometry.hpp +++ b/include/boost/geometry/geometries/helper_geometry.hpp @@ -40,7 +40,7 @@ template typename Point, typename NewCoordinateType, typename NewUnits, - typename CS_Tag = typename cs_tag::type + typename CS_Tag = cs_tag_t > struct helper_point { diff --git a/include/boost/geometry/io/dsv/write.hpp b/include/boost/geometry/io/dsv/write.hpp index e8b257a93a..39a046016e 100644 --- a/include/boost/geometry/io/dsv/write.hpp +++ b/include/boost/geometry/io/dsv/write.hpp @@ -326,11 +326,11 @@ class dsv_manipulator { dispatch::dsv < - typename tag_cast + tag_cast_t < - typename tag::type, + tag_t, multi_tag - >::type, + >, Geometry >::apply(os, m.m_geometry, m.m_settings); os.flush(); diff --git a/include/boost/geometry/io/svg/svg_mapper.hpp b/include/boost/geometry/io/svg/svg_mapper.hpp index 06ac64c3c2..a81e874e51 100644 --- a/include/boost/geometry/io/svg/svg_mapper.hpp +++ b/include/boost/geometry/io/svg/svg_mapper.hpp @@ -186,11 +186,7 @@ struct devarianted_svg_map { svg_map < - typename tag_cast - < - typename tag::type, - multi_tag - >::type, + tag_cast_t, multi_tag>, typename std::remove_const::type, SvgPoint >::apply(stream, style, size, geometry, strategy); diff --git a/include/boost/geometry/strategies/agnostic/point_in_point.hpp b/include/boost/geometry/strategies/agnostic/point_in_point.hpp index 051b87f401..84cde06abe 100644 --- a/include/boost/geometry/strategies/agnostic/point_in_point.hpp +++ b/include/boost/geometry/strategies/agnostic/point_in_point.hpp @@ -29,7 +29,7 @@ namespace strategy { namespace within template < typename Point1, typename Point2, - typename CSTag = typename cs_tag::type + typename CSTag = cs_tag_t > struct point_in_point : strategy::within::cartesian_point_point diff --git a/include/boost/geometry/strategies/agnostic/point_in_poly_oriented_winding.hpp b/include/boost/geometry/strategies/agnostic/point_in_poly_oriented_winding.hpp index 02e72cf051..90321dac59 100644 --- a/include/boost/geometry/strategies/agnostic/point_in_poly_oriented_winding.hpp +++ b/include/boost/geometry/strategies/agnostic/point_in_poly_oriented_winding.hpp @@ -65,10 +65,10 @@ class oriented_winding >::type calculation_type; - typedef typename strategy::side::services::default_strategy + using strategy_side_type = typename strategy::side::services::default_strategy < - typename cs_tag::type - >::type strategy_side_type; + cs_tag_t + >::type; /*! subclass to keep state */ diff --git a/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp b/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp index 07342ae10b..b7400d8523 100644 --- a/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp +++ b/include/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp @@ -45,11 +45,7 @@ template typename Point, typename PointOfSegment, typename CalculationType, - typename CSTag = typename tag_cast - < - typename cs_tag::type, - spherical_tag - >::type + typename CSTag = tag_cast_t, spherical_tag> > struct winding_base_type { @@ -65,7 +61,7 @@ struct winding_base_type < typename strategy::side::services::default_strategy < - typename cs_tag::type + cs_tag_t >::type, CalculationType >; @@ -76,10 +72,7 @@ struct winding_base_type { using type = within::detail::spherical_winding_base < - typename strategy::side::services::default_strategy - < - typename cs_tag::type - >::type, + typename strategy::side::services::default_strategy>::type, CalculationType >; }; diff --git a/include/boost/geometry/strategies/compare.hpp b/include/boost/geometry/strategies/compare.hpp index 83de81773c..ecfafc434c 100644 --- a/include/boost/geometry/strategies/compare.hpp +++ b/include/boost/geometry/strategies/compare.hpp @@ -216,8 +216,8 @@ template typename Point1, typename Point2 = Point1, int Dimension = -1, - typename CSTag1 = typename cs_tag::type, - typename CSTag2 = typename cs_tag::type + typename CSTag1 = cs_tag_t, + typename CSTag2 = cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/concepts/within_concept.hpp b/include/boost/geometry/strategies/concepts/within_concept.hpp index 8775613ec2..d296fc513a 100644 --- a/include/boost/geometry/strategies/concepts/within_concept.hpp +++ b/include/boost/geometry/strategies/concepts/within_concept.hpp @@ -369,9 +369,9 @@ inline void check() < Geometry1, Geometry2, - typename tag::type, - typename tag::type, - typename tag_cast::type, areal_tag>::type, + tag_t, + tag_t, + tag_cast_t, areal_tag>, Strategy > c; boost::ignore_unused(c); diff --git a/include/boost/geometry/strategies/convex_hull.hpp b/include/boost/geometry/strategies/convex_hull.hpp index 8208a4eb9f..ff1a9ed347 100644 --- a/include/boost/geometry/strategies/convex_hull.hpp +++ b/include/boost/geometry/strategies/convex_hull.hpp @@ -40,7 +40,7 @@ template < typename Geometry1, typename Point, - typename CsTag = typename cs_tag::type + typename CsTag = cs_tag_t > struct strategy_convex_hull { diff --git a/include/boost/geometry/strategies/covered_by.hpp b/include/boost/geometry/strategies/covered_by.hpp index 3c9a0caa83..34efeb4112 100644 --- a/include/boost/geometry/strategies/covered_by.hpp +++ b/include/boost/geometry/strategies/covered_by.hpp @@ -54,26 +54,26 @@ template typename GeometryContaining, typename TagContained = typename tag::type, typename TagContaining = typename tag::type, - typename CastedTagContained = typename tag_cast + typename CastedTagContained = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CastedTagContaining = typename tag_cast + >, + typename CastedTagContaining = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CsTagContained = typename tag_cast + >, + typename CsTagContained = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type, - typename CsTagContaining = typename tag_cast + >, + typename CsTagContaining = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type + > > struct default_strategy { diff --git a/include/boost/geometry/strategies/disjoint.hpp b/include/boost/geometry/strategies/disjoint.hpp index 9a52f5bc2e..3e24e6b6a4 100644 --- a/include/boost/geometry/strategies/disjoint.hpp +++ b/include/boost/geometry/strategies/disjoint.hpp @@ -33,12 +33,12 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, + typename Tag1 = tag_t, + typename Tag2 = tag_t, int TopDim1 = geometry::topological_dimension::value, int TopDim2 = geometry::topological_dimension::value, - typename CsTag1 = typename cs_tag::type, - typename CsTag2 = typename cs_tag::type + typename CsTag1 = cs_tag_t, + typename CsTag2 = cs_tag_t > struct default_strategy : relate::services::default_strategy diff --git a/include/boost/geometry/strategies/distance.hpp b/include/boost/geometry/strategies/distance.hpp index 9a886376dc..53b6e29c8e 100644 --- a/include/boost/geometry/strategies/distance.hpp +++ b/include/boost/geometry/strategies/distance.hpp @@ -94,8 +94,8 @@ template typename GeometryTag2, typename Point1, typename Point2 = Point1, - typename CsTag1 = typename cs_tag::type, - typename CsTag2 = typename cs_tag::type, + typename CsTag1 = cs_tag_t, + typename CsTag2 = cs_tag_t, typename UnderlyingStrategy = void > struct default_strategy diff --git a/include/boost/geometry/strategies/normalize.hpp b/include/boost/geometry/strategies/normalize.hpp index 0b45069983..8cfaf95227 100644 --- a/include/boost/geometry/strategies/normalize.hpp +++ b/include/boost/geometry/strategies/normalize.hpp @@ -229,11 +229,7 @@ struct spherical_point detail::normalize_point < PointIn, PointOut, - (! std::is_same - < - typename cs_tag::type, - spherical_polar_tag - >::value) + (! std::is_same, spherical_polar_tag>::value) >::apply(point_in, point_out); } }; @@ -246,11 +242,7 @@ struct spherical_box detail::normalize_box < BoxIn, BoxOut, - (! std::is_same - < - typename cs_tag::type, - spherical_polar_tag - >::value) + (! std::is_same, spherical_polar_tag>::value) >::apply(box_in, box_out); } }; diff --git a/include/boost/geometry/strategies/within.hpp b/include/boost/geometry/strategies/within.hpp index 954ceefe07..a63ccafcf7 100644 --- a/include/boost/geometry/strategies/within.hpp +++ b/include/boost/geometry/strategies/within.hpp @@ -52,28 +52,28 @@ template < typename GeometryContained, typename GeometryContaining, - typename TagContained = typename tag::type, - typename TagContaining = typename tag::type, - typename CastedTagContained = typename tag_cast + typename TagContained = tag_t, + typename TagContaining = tag_t, + typename CastedTagContained = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CastedTagContaining = typename tag_cast + >, + typename CastedTagContaining = tag_cast_t < - typename tag::type, + tag_t, pointlike_tag, linear_tag, polygonal_tag, areal_tag - >::type, - typename CsTagContained = typename tag_cast + >, + typename CsTagContained = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type, - typename CsTagContaining = typename tag_cast + >, + typename CsTagContaining = tag_cast_t < - typename cs_tag::type>::type, + cs_tag_t>, spherical_tag - >::type + > > struct default_strategy { diff --git a/include/boost/geometry/strategy/relate.hpp b/include/boost/geometry/strategy/relate.hpp index fa523d846f..a048e91aab 100644 --- a/include/boost/geometry/strategy/relate.hpp +++ b/include/boost/geometry/strategy/relate.hpp @@ -90,10 +90,7 @@ namespace detail template struct default_intersection_strategy - : strategy::intersection::services::default_strategy - < - typename cs_tag::type - > + : strategy::intersection::services::default_strategy> {}; template diff --git a/include/boost/geometry/strategy/spherical/envelope_segment.hpp b/include/boost/geometry/strategy/spherical/envelope_segment.hpp index 49b36192fd..75db51a763 100644 --- a/include/boost/geometry/strategy/spherical/envelope_segment.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_segment.hpp @@ -343,7 +343,7 @@ class envelope_segment_impl Box& mbr, Strategy const& strategy) { - typedef envelope_segment_convert_polar::type> convert_polar; + typedef envelope_segment_convert_polar> convert_polar; convert_polar::pre(lat1, lat2); diff --git a/include/boost/geometry/strategy/spherical/expand_point.hpp b/include/boost/geometry/strategy/spherical/expand_point.hpp index 354a4c8cfb..6260d90f21 100644 --- a/include/boost/geometry/strategy/spherical/expand_point.hpp +++ b/include/boost/geometry/strategy/spherical/expand_point.hpp @@ -189,7 +189,7 @@ struct spherical_point expand::detail::point_loop_on_spheroid < dimension::value, - ! std::is_same::type, spherical_polar_tag>::value + ! std::is_same, spherical_polar_tag>::value >::apply(box, point); } }; diff --git a/test/algorithms/distance/distance_brute_force.hpp b/test/algorithms/distance/distance_brute_force.hpp index 7c975cc1ff..b049d162f2 100644 --- a/test/algorithms/distance/distance_brute_force.hpp +++ b/test/algorithms/distance/distance_brute_force.hpp @@ -129,18 +129,8 @@ template typename Geometry1, typename Geometry2, typename Strategy, - typename Tag1 = typename tag_cast - < - typename tag::type, - segment_tag, - linear_tag - >::type, - typename Tag2 = typename tag_cast - < - typename tag::type, - segment_tag, - linear_tag - >::type, + typename Tag1 = tag_cast_t, segment_tag, linear_tag>, + typename Tag2 = tag_cast_t, segment_tag, linear_tag>, bool Reverse = reverse_dispatch::type::value > struct distance_brute_force diff --git a/test/util/is_implemented.cpp b/test/util/is_implemented.cpp index dd6e09b0fe..869114b2fc 100644 --- a/test/util/is_implemented.cpp +++ b/test/util/is_implemented.cpp @@ -49,8 +49,8 @@ template < typename Geometry1, typename Geometry2, typename Strategy, - typename Tag1 = typename tag_cast::type, multi_tag>::type, - typename Tag2 = typename tag_cast::type, multi_tag>::type, + typename Tag1 = tag_cast_t, multi_tag>, + typename Tag2 = tag_cast_t, multi_tag>, typename StrategyTag = typename strategy::services::tag::type, bool Reverse = reverse_dispatch::type::value >