From 75c7dfded77422a36c22db1ec27fe3666108c745 Mon Sep 17 00:00:00 2001 From: Vissarion Fisikopoulos Date: Tue, 4 Feb 2025 17:22:04 +0200 Subject: [PATCH] chore: Replace typedefs by using --- .../strategies/spherical/point_in_point.hpp | 12 ++--- .../util/normalize_spheroidal_coordinates.hpp | 31 +++---------- include/boost/geometry/util/rational.hpp | 6 +-- test/algorithms/equals/equals_on_spheroid.cpp | 12 ++--- .../difference/difference_linear_linear.cpp | 44 +++++++------------ 5 files changed, 37 insertions(+), 68 deletions(-) diff --git a/include/boost/geometry/strategies/spherical/point_in_point.hpp b/include/boost/geometry/strategies/spherical/point_in_point.hpp index 3f6a81b46..21ed2066f 100644 --- a/include/boost/geometry/strategies/spherical/point_in_point.hpp +++ b/include/boost/geometry/strategies/spherical/point_in_point.hpp @@ -68,8 +68,8 @@ private: { static inline bool apply(Point1 const& point1, Point2 const& point2) { - typedef typename helper_geometry::type helper_point_type1; - typedef typename helper_geometry::type helper_point_type2; + using helper_point_type1 = typename helper_geometry::type; + using helper_point_type2 = typename helper_geometry::type; helper_point_type1 point1_normalized; bool const exact_normalized = false; @@ -89,11 +89,11 @@ private: { static inline bool apply(Point1 const& point1, Point2 const& point2) { - typedef typename geometry::select_most_precise + using calculation_type = typename geometry::select_most_precise < typename fp_coordinate_type::type, typename fp_coordinate_type::type - >::type calculation_type; + >::type; typename helper_geometry < @@ -151,7 +151,7 @@ namespace services template struct default_strategy { - typedef strategy::within::spherical_point_point type; + using type = strategy::within::spherical_point_point; }; } // namespace services @@ -168,7 +168,7 @@ namespace strategy { namespace covered_by { namespace services template struct default_strategy { - typedef strategy::within::spherical_point_point type; + using type = strategy::within::spherical_point_point; }; }}} // namespace strategy::covered_by::services diff --git a/include/boost/geometry/util/normalize_spheroidal_coordinates.hpp b/include/boost/geometry/util/normalize_spheroidal_coordinates.hpp index 8f5530a0f..6fa52d738 100644 --- a/include/boost/geometry/util/normalize_spheroidal_coordinates.hpp +++ b/include/boost/geometry/util/normalize_spheroidal_coordinates.hpp @@ -152,11 +152,7 @@ struct constants_on_spheroid template inline CoordinateType latitude_convert_ep(CoordinateType const& lat) { - typedef math::detail::constants_on_spheroid - < - CoordinateType, - Units - > constants; + using constants = math::detail::constants_on_spheroid; return constants::quarter_period() - lat; } @@ -165,31 +161,21 @@ inline CoordinateType latitude_convert_ep(CoordinateType const& lat) template static bool is_latitude_pole(T const& lat) { - typedef math::detail::constants_on_spheroid - < - T, - Units - > constants; + using constants = math::detail::constants_on_spheroid; return math::equals(math::abs(IsEquatorial ? lat : math::latitude_convert_ep(lat)), constants::quarter_period()); - } template static bool is_longitude_antimeridian(T const& lon) { - typedef math::detail::constants_on_spheroid - < - T, - Units - > constants; + using constants = math::detail::constants_on_spheroid; return math::equals(math::abs(lon), constants::half_period()); - } @@ -219,7 +205,7 @@ struct latitude_convert_if_polar template class normalize_spheroidal_coordinates { - typedef constants_on_spheroid constants; + using constants = constants_on_spheroid; protected: static inline CoordinateType normalize_up(CoordinateType const& value) @@ -324,7 +310,7 @@ public: template inline void normalize_angle_loop(CoordinateType& angle) { - typedef constants_on_spheroid constants; + using constants = constants_on_spheroid; CoordinateType const pi = constants::half_period(); CoordinateType const two_pi = constants::period(); while (angle > pi) @@ -336,7 +322,7 @@ inline void normalize_angle_loop(CoordinateType& angle) template inline void normalize_angle_cond(CoordinateType& angle) { - typedef constants_on_spheroid constants; + using constants = constants_on_spheroid; CoordinateType const pi = constants::half_period(); CoordinateType const two_pi = constants::period(); if (angle > pi) @@ -462,10 +448,7 @@ template inline CoordinateType longitude_distance_unsigned(CoordinateType const& longitude1, CoordinateType const& longitude2) { - typedef math::detail::constants_on_spheroid - < - CoordinateType, Units - > constants; + using constants = math::detail::constants_on_spheroid; CoordinateType const c0 = 0; CoordinateType diff = longitude_distance_signed(longitude1, longitude2); diff --git a/include/boost/geometry/util/rational.hpp b/include/boost/geometry/util/rational.hpp index bfe6161e7..e9a1244b9 100644 --- a/include/boost/geometry/util/rational.hpp +++ b/include/boost/geometry/util/rational.hpp @@ -101,16 +101,16 @@ struct coordinate_cast > template struct select_most_precise, boost::rational > { - typedef typename boost::rational + using type = typename boost::rational < typename select_most_precise::type - > type; + > ; }; template struct select_most_precise, double> { - typedef typename boost::rational type; + using type = typename boost::rational; }; namespace util diff --git a/test/algorithms/equals/equals_on_spheroid.cpp b/test/algorithms/equals/equals_on_spheroid.cpp index f0c35e684..04fc80fb4 100644 --- a/test/algorithms/equals/equals_on_spheroid.cpp +++ b/test/algorithms/equals/equals_on_spheroid.cpp @@ -130,7 +130,7 @@ struct test_point_point_with_height template void test_segment_segment(std::string const& header) { - typedef bgm::segment

seg; + using seg = bgm::segment

; std::string const str = header + "-"; @@ -159,7 +159,7 @@ void test_segment_segment(std::string const& header) BOOST_AUTO_TEST_CASE( equals_point_point_se ) { - typedef bg::cs::spherical_equatorial cs_type; + using cs_type = bg::cs::spherical_equatorial; test_point_point >::apply("se"); test_point_point >::apply("se"); @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_radian ) BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se ) { - typedef bg::cs::spherical_equatorial cs_type; + using cs_type = bg::cs::spherical_equatorial; test_point_point >::apply("seh"); test_point_point >::apply("seh"); @@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se ) BOOST_AUTO_TEST_CASE( equals_point_point_geo ) { - typedef bg::cs::geographic cs_type; + using cs_type = bg::cs::geographic; test_point_point >::apply("geo"); test_point_point >::apply("geo"); @@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_geo ) BOOST_AUTO_TEST_CASE( equals_segment_segment_se ) { - typedef bg::cs::spherical_equatorial cs_type; + using cs_type = bg::cs::spherical_equatorial; test_segment_segment >("se"); test_segment_segment >("se"); @@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE( equals_segment_segment_se ) BOOST_AUTO_TEST_CASE( equals_segment_segment_geo ) { - typedef bg::cs::geographic cs_type; + using cs_type = bg::cs::geographic; test_segment_segment >("geo"); test_segment_segment >("geo"); diff --git a/test/algorithms/set_operations/difference/difference_linear_linear.cpp b/test/algorithms/set_operations/difference/difference_linear_linear.cpp index 3e3c7105c..e448d60f9 100644 --- a/test/algorithms/set_operations/difference/difference_linear_linear.cpp +++ b/test/algorithms/set_operations/difference/difference_linear_linear.cpp @@ -27,11 +27,12 @@ #include #include -typedef bg::model::point point_type; -typedef bg::model::segment segment_type; -typedef bg::model::linestring linestring_type; -typedef bg::model::multi_linestring multi_linestring_type; - +using point_type = bg::model::point; +using segment_type = bg::model::segment; +using linestring_type = bg::model::linestring; +using multi_linestring_type = bg::model::multi_linestring; +using L = linestring_type; +using ML = multi_linestring_type; //=========================================================================== @@ -47,10 +48,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring ) std::cout << std::endl; #endif - typedef linestring_type L; - typedef multi_linestring_type ML; - - typedef test_difference_of_geometries tester; + using tester = test_difference_of_geometries; tester::apply (from_wkt("LINESTRING(0 0,1 1,2 1,3 2)"), @@ -566,10 +564,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_multilinestring ) std::cout << std::endl; #endif - typedef linestring_type L; - typedef multi_linestring_type ML; - - typedef test_difference_of_geometries tester; + using tester = test_difference_of_geometries; // disjoint linestrings tester::apply @@ -790,10 +785,7 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_linestring ) std::cout << std::endl; #endif - typedef linestring_type L; - typedef multi_linestring_type ML; - - typedef test_difference_of_geometries tester; + using tester = test_difference_of_geometries; // disjoint linestrings tester::apply @@ -875,9 +867,7 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_multilinestring ) std::cout << std::endl; #endif - typedef multi_linestring_type ML; - - typedef test_difference_of_geometries tester; + using tester = test_difference_of_geometries; // disjoint linestrings tester::apply @@ -1167,9 +1157,7 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_degenerate ) std::cout << std::endl; #endif - typedef multi_linestring_type ML; - - typedef test_difference_of_geometries tester; + using tester = test_difference_of_geometries; // the following test cases concern linestrings with duplicate // points and possibly linestrings with zero length. @@ -1254,9 +1242,7 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes ) std::cout << std::endl; #endif - typedef multi_linestring_type ML; - - typedef test_difference_of_geometries tester; + using tester = test_difference_of_geometries; // the following test cases concern linestrings with spikes @@ -1446,9 +1432,9 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes ) BOOST_AUTO_TEST_CASE( test_difference_ls_mls_geo_rad ) { - typedef bg::model::point > pt; - typedef bg::model::linestring ls; - typedef bg::model::multi_linestring mls; + using pt = bg::model::point>; + using ls = bg::model::linestring; + using mls = bg::model::multi_linestring; bg::srs::spheroid sph_wgs84(6378137.0, 6356752.3142451793); boost::geometry::strategy::intersection::geographic_segments<> wgs84(sph_wgs84);