From 51cf51a25d10900d73c77cd14b7d1242a16db008 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 2 Mar 2024 23:47:31 +0100 Subject: [PATCH] Add alias templates for core and util traits Add C++17 variable templates for traits behind #ifdef Use aliases in several algorithms --- include/boost/geometry/algorithms/append.hpp | 19 ++- include/boost/geometry/algorithms/area.hpp | 36 ++--- include/boost/geometry/algorithms/assign.hpp | 17 +-- .../boost/geometry/algorithms/centroid.hpp | 18 +-- include/boost/geometry/algorithms/clear.hpp | 11 +- include/boost/geometry/algorithms/convert.hpp | 56 +++----- include/boost/geometry/algorithms/correct.hpp | 12 +- .../geometry/algorithms/correct_closure.hpp | 5 +- include/boost/geometry/core/access.hpp | 135 ++++++++---------- include/boost/geometry/core/closure.hpp | 35 +++-- .../geometry/core/coordinate_dimension.hpp | 12 +- .../boost/geometry/core/coordinate_system.hpp | 13 +- .../boost/geometry/core/coordinate_type.hpp | 35 +++-- include/boost/geometry/core/cs.hpp | 27 +++- include/boost/geometry/core/geometry_id.hpp | 7 + include/boost/geometry/core/point_order.hpp | 24 +++- include/boost/geometry/core/point_type.hpp | 13 +- include/boost/geometry/core/radius.hpp | 111 +++++++------- .../boost/geometry/core/reverse_dispatch.hpp | 5 +- include/boost/geometry/core/ring_type.hpp | 15 +- include/boost/geometry/core/tag.hpp | 12 +- include/boost/geometry/core/tag_cast.hpp | 14 +- include/boost/geometry/core/tags.hpp | 3 + .../geometry/core/topological_dimension.hpp | 7 + include/boost/geometry/util/type_traits.hpp | 112 +++++++++++---- .../boost/geometry/util/type_traits_std.hpp | 16 ++- 26 files changed, 451 insertions(+), 319 deletions(-) diff --git a/include/boost/geometry/algorithms/append.hpp b/include/boost/geometry/algorithms/append.hpp index 4bb25fcb11..cd61be0174 100644 --- a/include/boost/geometry/algorithms/append.hpp +++ b/include/boost/geometry/algorithms/append.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2023. // Modifications copyright (c) 2014-2023, Oracle and/or its affiliates. @@ -60,7 +61,7 @@ struct to_range_point static inline void apply(Geometry& geometry, Point const& point, signed_size_type = -1, signed_size_type = 0) { - typename geometry::point_type::type copy; + geometry::point_type_t copy; geometry::detail::conversion::convert_point_to_point(point, copy); traits::push_back::apply(geometry, copy); } @@ -90,7 +91,7 @@ struct to_polygon_point static inline void apply(Polygon& polygon, Point const& point, signed_size_type ring_index, signed_size_type = 0) { - using ring_type = typename ring_type::type; + using ring_type = ring_type_t; if (ring_index == -1) { @@ -112,18 +113,16 @@ struct to_polygon_range static inline void apply(Polygon& polygon, Range const& range, signed_size_type ring_index, signed_size_type = 0) { - using ring_type = typename ring_type::type; - using exterior_ring_type = typename ring_return_type::type; - using interior_ring_range_type = typename interior_return_type::type; - + using ring_type = ring_type_t; + if (ring_index == -1) { - exterior_ring_type ext_ring = exterior_ring(polygon); + auto&& ext_ring = exterior_ring(polygon); to_range_range::apply(ext_ring, range); } else if (ring_index < signed_size_type(num_interior_rings(polygon))) { - interior_ring_range_type int_rings = interior_rings(polygon); + auto&& int_rings = interior_rings(polygon); to_range_range::apply(range::at(int_rings, ring_index), range); } } @@ -159,8 +158,8 @@ template < typename Geometry, typename RangeOrPoint, - typename Tag = typename geometry::tag::type, - typename OtherTag = typename geometry::tag::type + typename Tag = geometry::tag_t, + typename OtherTag = geometry::tag_t > struct append : detail::append::append_no_action diff --git a/include/boost/geometry/algorithms/area.hpp b/include/boost/geometry/algorithms/area.hpp index 9b5af61e12..50f48d7292 100644 --- a/include/boost/geometry/algorithms/area.hpp +++ b/include/boost/geometry/algorithms/area.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2017-2022 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2017-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. @@ -131,13 +131,12 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct area : detail::calculate_null { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { return calculate_null::apply < @@ -162,8 +161,7 @@ template struct area : detail::calculate_polygon_sum { template - static inline typename area_result::type - apply(Polygon const& polygon, Strategy const& strategy) + static inline auto apply(Polygon const& polygon, Strategy const& strategy) { return calculate_polygon_sum::apply < @@ -178,8 +176,7 @@ template struct area : detail::multi_sum { template - static inline typename area_result::type - apply(MultiGeometry const& multi, Strategy const& strategy) + static inline auto apply(MultiGeometry const& multi, Strategy const& strategy) { return multi_sum::apply < @@ -205,8 +202,7 @@ template struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { return dispatch::area::apply(geometry, strategy); } @@ -230,8 +226,7 @@ template <> struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, default_strategy) + static inline auto apply(Geometry const& geometry, default_strategy) { typedef typename strategies::area::services::default_strategy < @@ -249,12 +244,11 @@ struct area namespace resolve_dynamic { -template ::type> +template > struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { return resolve_strategy::area::apply(geometry, strategy); } @@ -264,8 +258,7 @@ template struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { typename area_result::type result = 0; traits::visit::apply([&](auto const& g) @@ -280,8 +273,7 @@ template struct area { template - static inline typename area_result::type - apply(Geometry const& geometry, Strategy const& strategy) + static inline auto apply(Geometry const& geometry, Strategy const& strategy) { typename area_result::type result = 0; detail::visit_breadth_first([&](auto const& g) @@ -318,8 +310,7 @@ and Geographic as well. \qbk{[area] [area_output]} */ template -inline typename area_result::type -area(Geometry const& geometry) +inline auto area(Geometry const& geometry) { concepts::check(); @@ -354,8 +345,7 @@ area(Geometry const& geometry) } */ template -inline typename area_result::type -area(Geometry const& geometry, Strategy const& strategy) +inline auto area(Geometry const& geometry, Strategy const& strategy) { concepts::check(); diff --git a/include/boost/geometry/algorithms/assign.hpp b/include/boost/geometry/algorithms/assign.hpp index 5386ac6494..27e168f807 100644 --- a/include/boost/geometry/algorithms/assign.hpp +++ b/include/boost/geometry/algorithms/assign.hpp @@ -4,6 +4,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2014 Samuel Debionne, Grenoble, France. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2023. // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. @@ -91,7 +92,7 @@ inline void assign_inverse(Geometry& geometry) dispatch::assign_inverse < - typename tag::type, + tag_t, Geometry >::apply(geometry); } @@ -111,7 +112,7 @@ inline void assign_zero(Geometry& geometry) dispatch::assign_zero < - typename tag::type, + tag_t, Geometry >::apply(geometry); } @@ -141,9 +142,9 @@ inline void assign_values(Geometry& geometry, Type const& c1, Type const& c2) dispatch::assign < - typename tag::type, + tag_t, Geometry, - geometry::dimension::type::value + geometry::dimension::value >::apply(geometry, c1, c2); } @@ -174,9 +175,9 @@ inline void assign_values(Geometry& geometry, dispatch::assign < - typename tag::type, + tag_t, Geometry, - geometry::dimension::type::value + geometry::dimension::value >::apply(geometry, c1, c2, c3); } @@ -201,9 +202,9 @@ inline void assign_values(Geometry& geometry, dispatch::assign < - typename tag::type, + tag_t, Geometry, - geometry::dimension::type::value + geometry::dimension::value >::apply(geometry, c1, c2, c3, c4); } diff --git a/include/boost/geometry/algorithms/centroid.hpp b/include/boost/geometry/algorithms/centroid.hpp index 43ac999e51..1817d8addc 100644 --- a/include/boost/geometry/algorithms/centroid.hpp +++ b/include/boost/geometry/algorithms/centroid.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// Copyright (c) 2014-2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2023. // Modifications copyright (c) 2014-2023 Oracle and/or its affiliates. @@ -184,7 +184,7 @@ struct centroid_range_state typename PointTransformer::result_type pt = transformer.apply(*it); - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; strategy.apply(static_cast(previous_pt), static_cast(pt), state); @@ -208,7 +208,7 @@ struct centroid_range typename Strategy::template state_type < - typename geometry::point_type::type, + geometry::point_type_t, Point >::type state; @@ -265,7 +265,7 @@ struct centroid_polygon typename Strategy::template state_type < - typename geometry::point_type::type, + geometry::point_type_t, Point >::type state; @@ -333,7 +333,7 @@ struct centroid_multi typename Strategy::template state_type < - typename geometry::point_type::type, + geometry::point_type_t, Point >::type state; @@ -393,7 +393,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct centroid: not_implemented {}; @@ -511,10 +511,10 @@ struct centroid template static inline void apply(Geometry const& geometry, Point& out, default_strategy) { - typedef typename strategies::centroid::services::default_strategy + using strategies_type = typename strategies::centroid::services::default_strategy < Geometry - >::type strategies_type; + >::type; dispatch::centroid::apply(geometry, out, strategies_type()); } @@ -525,7 +525,7 @@ struct centroid namespace resolve_dynamic { -template ::type> +template > struct centroid { template diff --git a/include/boost/geometry/algorithms/clear.hpp b/include/boost/geometry/algorithms/clear.hpp index df3acc8bdc..efaa93d184 100644 --- a/include/boost/geometry/algorithms/clear.hpp +++ b/include/boost/geometry/algorithms/clear.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2023. // Modifications copyright (c) 2020-2023, Oracle and/or its affiliates. @@ -56,17 +57,17 @@ struct polygon_clear { traits::clear < - typename std::remove_reference + std::remove_reference_t < typename traits::interior_mutable_type::type - >::type + > >::apply(interior_rings(polygon)); traits::clear < - typename std::remove_reference + std::remove_reference_t < typename traits::ring_mutable_type::type - >::type + > >::apply(exterior_ring(polygon)); } }; @@ -90,7 +91,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag_cast::type, multi_tag>::type + typename Tag = tag_cast_t, multi_tag> > struct clear: not_implemented {}; diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp index e61b50c30c..53db232f7e 100644 --- a/include/boost/geometry/algorithms/convert.hpp +++ b/include/boost/geometry/algorithms/convert.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023, Oracle and/or its affiliates. @@ -77,10 +77,8 @@ struct point_to_box { static inline void apply(Point const& point, Box& box) { - typedef typename coordinate_type::type coordinate_type; - set(box, - util::numeric_cast(get(point))); + util::numeric_cast>(get(point))); point_to_box < Point, Box, @@ -171,8 +169,7 @@ struct range_to_range // point for open output. view_type const view(source); - typedef typename boost::range_size::type size_type; - size_type n = boost::size(view); + auto n = boost::size(view); if (geometry::closure::value == geometry::open) { n--; @@ -181,7 +178,7 @@ struct range_to_range // If size == 0 && geometry::open <=> n = numeric_limits::max() // but ok, sice below it == end() - size_type i = 0; + decltype(n) i = 0; for (auto it = boost::begin(view); it != boost::end(view) && i < n; ++it, ++i) @@ -198,13 +195,12 @@ struct range_to_range template struct polygon_to_polygon { - typedef range_to_range + using per_ring = range_to_range < - typename geometry::ring_type::type, - typename geometry::ring_type::type, - geometry::point_order::value - != geometry::point_order::value - > per_ring; + geometry::ring_type_t, + geometry::ring_type_t, + geometry::point_order::value != geometry::point_order::value + >; static inline void apply(Polygon1 const& source, Polygon2& destination) { @@ -216,10 +212,10 @@ struct polygon_to_polygon // Container should be resizeable traits::resize < - typename std::remove_reference - < - typename traits::interior_mutable_type::type - >::type + std::remove_reference_t + < + typename traits::interior_mutable_type::type + > >::apply(interior_rings(destination), num_interior_rings(source)); auto const& rings_source = interior_rings(source); @@ -280,9 +276,9 @@ 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, - std::size_t DimensionCount = dimension::type::value, + typename Tag1 = tag_cast_t, multi_tag>, + typename Tag2 = tag_cast_t, multi_tag>, + std::size_t DimensionCount = dimension::value, bool UseAssignment = std::is_same::value && !std::is_array::value > @@ -353,8 +349,7 @@ struct convert < Ring1, Ring2, - geometry::point_order::value - != geometry::point_order::value + geometry::point_order::value != geometry::point_order::value > {}; @@ -461,14 +456,8 @@ struct convert < typename boost::range_value::type, typename boost::range_value::type, - typename single_tag_of - < - typename tag::type - >::type, - typename single_tag_of - < - typename tag::type - >::type, + single_tag_of_t>, + single_tag_of_t>, DimensionCount > > @@ -485,11 +474,8 @@ struct convert < Single, typename boost::range_value::type, - typename tag::type, - typename single_tag_of - < - typename tag::type - >::type, + tag_t, + single_tag_of_t>, DimensionCount, false > diff --git a/include/boost/geometry/algorithms/correct.hpp b/include/boost/geometry/algorithms/correct.hpp index 20a94de85c..92b9d9c20b 100644 --- a/include/boost/geometry/algorithms/correct.hpp +++ b/include/boost/geometry/algorithms/correct.hpp @@ -3,7 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// Copyright (c) 2014-2017 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2014-2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017-2023. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. @@ -75,8 +75,6 @@ struct correct_box template static inline void apply(Box& box, Strategy const& ) { - using coordinate_type = typename geometry::coordinate_type::type; - // Currently only for Cartesian coordinates // (or spherical without crossing dateline) // Future version: adapt using strategies @@ -85,8 +83,8 @@ struct correct_box if (get(box) > get(box)) { // Swap the coordinates - coordinate_type max_value = get(box); - coordinate_type min_value = get(box); + auto max_value = get(box); + auto min_value = get(box); set(box, min_value); set(box, max_value); } @@ -144,7 +142,7 @@ struct correct_polygon namespace dispatch { -template ::type> +template > struct correct: not_implemented {}; @@ -252,7 +250,7 @@ struct correct namespace resolve_dynamic { -template ::type> +template > struct correct { template diff --git a/include/boost/geometry/algorithms/correct_closure.hpp b/include/boost/geometry/algorithms/correct_closure.hpp index 0521c38b81..3ea35c4d6d 100644 --- a/include/boost/geometry/algorithms/correct_closure.hpp +++ b/include/boost/geometry/algorithms/correct_closure.hpp @@ -1,6 +1,7 @@ // Boost.Geometry // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2023. // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. @@ -102,7 +103,7 @@ struct close_or_open_polygon namespace dispatch { -template ::type> +template > struct correct_closure: not_implemented {}; @@ -166,7 +167,7 @@ struct correct_closure namespace resolve_variant { -template ::type> +template > struct correct_closure { static inline void apply(Geometry& geometry) diff --git a/include/boost/geometry/core/access.hpp b/include/boost/geometry/core/access.hpp index c59ff12c5c..c34f35b012 100644 --- a/include/boost/geometry/core/access.hpp +++ b/include/boost/geometry/core/access.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -75,7 +76,12 @@ struct access \ingroup traits */ template -struct indexed_access {}; +struct indexed_access +{ + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry type.", + Geometry); +}; } // namespace traits @@ -87,17 +93,16 @@ namespace detail template < typename Geometry, - typename CoordinateType, std::size_t Index, std::size_t Dimension > struct indexed_access_non_pointer { - static constexpr CoordinateType get(Geometry const& geometry) + static constexpr coordinate_type_t get(Geometry const& geometry) { return traits::indexed_access::get(geometry); } - static void set(Geometry& b, CoordinateType const& value) + static void set(Geometry& b, coordinate_type_t const& value) { traits::indexed_access::set(b, value); } @@ -106,19 +111,18 @@ struct indexed_access_non_pointer template < typename Geometry, - typename CoordinateType, std::size_t Index, std::size_t Dimension > struct indexed_access_pointer { - static constexpr CoordinateType get(Geometry const* geometry) + static constexpr coordinate_type_t get(Geometry const* geometry) { - return traits::indexed_access::type, Index, Dimension>::get(*geometry); + return traits::indexed_access, Index, Dimension>::get(*geometry); } - static void set(Geometry* geometry, CoordinateType const& value) + static void set(Geometry* geometry, coordinate_type_t const& value) { - traits::indexed_access::type, Index, Dimension>::set(*geometry, value); + traits::indexed_access, Index, Dimension>::set(*geometry, value); } }; @@ -135,13 +139,14 @@ template < typename Tag, typename Geometry, - typename - CoordinateType, std::size_t Dimension, - typename IsPointer + bool IsPointer > struct access { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //static inline T get(G const&) {} //static inline void set(G& g, T const& value) {} }; @@ -150,40 +155,42 @@ template < typename Tag, typename Geometry, - typename CoordinateType, std::size_t Index, std::size_t Dimension, - typename IsPointer + bool IsPointer > struct indexed_access { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //static inline T get(G const&) {} //static inline void set(G& g, T const& value) {} }; -template -struct access +template +struct access { - static constexpr CoordinateType get(Point const& point) + static constexpr coordinate_type_t get(Point const& point) { return traits::access::get(point); } - static void set(Point& p, CoordinateType const& value) + static void set(Point& p, coordinate_type_t const& value) { traits::access::set(p, value); } }; -template -struct access +template +struct access { - static constexpr CoordinateType get(Point const* point) + static constexpr coordinate_type_t get(Point const* point) { - return traits::access::type, Dimension>::get(*point); + return traits::access, Dimension>::get(*point); } - static void set(Point* p, CoordinateType const& value) + static void set(Point* p, coordinate_type_t const& value) { - traits::access::type, Dimension>::set(*p, value); + traits::access, Dimension>::set(*p, value); } }; @@ -191,47 +198,43 @@ struct access template < typename Box, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_non_pointer +struct indexed_access + : detail::indexed_access_non_pointer {}; template < typename Box, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_pointer +struct indexed_access + : detail::indexed_access_pointer {}; template < typename Segment, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_non_pointer +struct indexed_access + : detail::indexed_access_non_pointer {}; template < typename Segment, - typename CoordinateType, std::size_t Index, std::size_t Dimension > -struct indexed_access - : detail::indexed_access_pointer +struct indexed_access + : detail::indexed_access_pointer {}; } // namespace core_dispatch @@ -265,22 +268,19 @@ struct signature_getset_index_dimension {}; \qbk{[include reference/core/get_point.qbk]} */ template -constexpr inline typename coordinate_type::type get(Geometry const& geometry +constexpr inline coordinate_type_t get(Geometry const& geometry #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_dimension* = 0 #endif ) { - typedef core_dispatch::access + return core_dispatch::access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Dimension, - typename std::is_pointer::type - > coord_access_type; - - return coord_access_type::get(geometry); + std::is_pointer::value + >::get(geometry); } @@ -298,22 +298,19 @@ constexpr inline typename coordinate_type::type get(Geometry const& ge */ template inline void set(Geometry& geometry - , typename coordinate_type::type const& value + , coordinate_type_t const& value #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_dimension* = 0 #endif ) { - typedef core_dispatch::access + core_dispatch::access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Dimension, - typename std::is_pointer::type - > coord_access_type; - - coord_access_type::set(geometry, value); + std::is_pointer::value + >::set(geometry, value); } @@ -331,23 +328,20 @@ inline void set(Geometry& geometry \qbk{[include reference/core/get_box.qbk]} */ template -constexpr inline typename coordinate_type::type get(Geometry const& geometry +constexpr inline coordinate_type_t get(Geometry const& geometry #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_index_dimension* = 0 #endif ) { - typedef core_dispatch::indexed_access + return core_dispatch::indexed_access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Index, Dimension, - typename std::is_pointer::type - > coord_access_type; - - return coord_access_type::get(geometry); + std::is_pointer::value + >::get(geometry); } /*! @@ -366,23 +360,20 @@ constexpr inline typename coordinate_type::type get(Geometry const& ge */ template inline void set(Geometry& geometry - , typename coordinate_type::type const& value + , coordinate_type_t const& value #ifndef DOXYGEN_SHOULD_SKIP_THIS , detail::signature_getset_index_dimension* = 0 #endif ) { - typedef core_dispatch::indexed_access + core_dispatch::indexed_access < - typename tag::type, - typename util::remove_cptrref::type, - typename coordinate_type::type, + tag_t, + util::remove_cptrref_t, Index, Dimension, - typename std::is_pointer::type - > coord_access_type; - - coord_access_type::set(geometry, value); + std::is_pointer::value + >::set(geometry, value); } }} // namespace boost::geometry diff --git a/include/boost/geometry/core/closure.hpp b/include/boost/geometry/core/closure.hpp index 46c3d79346..09abb8e103 100644 --- a/include/boost/geometry/core/closure.hpp +++ b/include/boost/geometry/core/closure.hpp @@ -3,7 +3,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. - +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. +// // This file was modified by Oracle on 2014-2021. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -187,25 +188,33 @@ struct closure */ template struct closure -{ - static const closure_selector value = core_dispatch::closure + : std::integral_constant < - typename tag::type, - typename util::remove_cptrref::type - >::value; -}; + closure_selector, + core_dispatch::closure + < + tag_t, + util::remove_cptrref_t + >::value + > +{}; + +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr closure_selector closure_v = closure::value; +#endif #ifndef DOXYGEN_NO_DETAIL namespace detail { -template -< - typename Geometry, - closure_selector Closure = geometry::closure::value -> -using minimum_ring_size = core_detail::closure::minimum_ring_size; +template +using minimum_ring_size = core_detail::closure::minimum_ring_size + < + geometry::closure::value + >; + } // namespace detail #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/core/coordinate_dimension.hpp b/include/boost/geometry/core/coordinate_dimension.hpp index 3a87dabf5c..7f2e94ac0d 100644 --- a/include/boost/geometry/core/coordinate_dimension.hpp +++ b/include/boost/geometry/core/coordinate_dimension.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -88,11 +89,18 @@ template struct dimension : core_dispatch::dimension < - typename tag::type, - typename util::remove_cptrref::type + tag_t, + util::remove_cptrref_t > {}; + +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr std::size_t dimension_v = dimension::value; +#endif + + /*! \brief assert_dimension, enables compile-time checking if coordinate dimensions are as expected \ingroup utility diff --git a/include/boost/geometry/core/coordinate_system.hpp b/include/boost/geometry/core/coordinate_system.hpp index a9dae31edd..cebdbc2e64 100644 --- a/include/boost/geometry/core/coordinate_system.hpp +++ b/include/boost/geometry/core/coordinate_system.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -88,14 +89,18 @@ namespace core_dispatch template struct coordinate_system { - typedef typename core_dispatch::coordinate_system + using type = typename core_dispatch::coordinate_system < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + tag_t, + util::remove_cptrref_t + >::type; }; +template +using coordinate_system_t = typename coordinate_system::type; + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/coordinate_type.hpp b/include/boost/geometry/core/coordinate_type.hpp index 760b122ad3..ab86b09c63 100644 --- a/include/boost/geometry/core/coordinate_type.hpp +++ b/include/boost/geometry/core/coordinate_type.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -56,19 +57,21 @@ namespace core_dispatch template struct coordinate_type { - typedef typename point_type::type point_type; - // Call its own specialization on point-tag - typedef typename coordinate_type::type type; + using type = typename coordinate_type + < + point_tag, + typename point_type::type + >::type; }; template struct coordinate_type { - typedef typename traits::coordinate_type + using type = typename traits::coordinate_type < - typename util::remove_cptrref::type - >::type type; + util::remove_cptrref_t + >::type; }; @@ -86,13 +89,18 @@ struct coordinate_type template struct coordinate_type { - typedef typename core_dispatch::coordinate_type + using type = typename core_dispatch::coordinate_type < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + tag_t, + util::remove_cptrref_t + >::type; }; + +template +using coordinate_type_t = typename coordinate_type::type; + + /*! \brief assert_coordinate_type_equal, a compile-time check for equality of two coordinate types \ingroup utility @@ -100,11 +108,8 @@ struct coordinate_type template constexpr inline void assert_coordinate_type_equal(Geometry1 const& , Geometry2 const& ) { - static_assert(std::is_same - < - typename coordinate_type::type, - typename coordinate_type::type - >::value, "Coordinate types in geometries should be the same"); + static_assert(std::is_same, coordinate_type_t>::value, + "Coordinate types in geometries should be the same"); } }} // namespace boost::geometry diff --git a/include/boost/geometry/core/cs.hpp b/include/boost/geometry/core/cs.hpp index 0e2f4c5c10..e6bc4e34f0 100644 --- a/include/boost/geometry/core/cs.hpp +++ b/include/boost/geometry/core/cs.hpp @@ -3,10 +3,10 @@ // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020, Oracle and/or its affiliates. - // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -237,13 +237,17 @@ struct cs_tag template struct cs_tag { - typedef typename traits::cs_tag + using type = typename traits::cs_tag < - typename geometry::coordinate_system::type - >::type type; + geometry::coordinate_system_t + >::type; }; +template +using cs_tag_t = typename cs_tag::type; + + namespace traits { @@ -287,13 +291,17 @@ namespace detail template struct cs_angular_units { - typedef typename traits::cs_angular_units + using type = typename traits::cs_angular_units < - typename geometry::coordinate_system::type - >::type type; + geometry::coordinate_system_t + >::type; }; +template +using cs_angular_units_t = typename cs_angular_units::type; + + template struct cs_tag_to_coordinate_system { @@ -332,6 +340,11 @@ struct cs_tag_to_coordinate_system typedef cs::geographic type; }; + +template +using cs_tag_to_coordinate_system_t = typename cs_tag_to_coordinate_system::type; + + } // namespace detail #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/core/geometry_id.hpp b/include/boost/geometry/core/geometry_id.hpp index 2c68cedcd9..ed2a238c6b 100644 --- a/include/boost/geometry/core/geometry_id.hpp +++ b/include/boost/geometry/core/geometry_id.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020 Oracle and/or its affiliates. @@ -103,6 +104,12 @@ struct geometry_id : core_dispatch::geometry_id::type> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr int geometry_id_v = geometry_id::value; +#endif + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/point_order.hpp b/include/boost/geometry/core/point_order.hpp index 2fedae5992..8f8cddd6c6 100644 --- a/include/boost/geometry/core/point_order.hpp +++ b/include/boost/geometry/core/point_order.hpp @@ -3,10 +3,10 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. - // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -172,13 +172,23 @@ struct point_order */ template struct point_order -{ - static const order_selector value = core_dispatch::point_order + : std::integral_constant < - typename tag::type, - typename util::remove_cptrref::type - >::value; -}; + order_selector, + core_dispatch::point_order + < + tag_t, + util::remove_cptrref_t + >::value + > +{}; + + +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr order_selector point_order_v = point_order::value; +#endif + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/point_type.hpp b/include/boost/geometry/core/point_type.hpp index f5d2823726..ccb259c16d 100644 --- a/include/boost/geometry/core/point_type.hpp +++ b/include/boost/geometry/core/point_type.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2021. // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates. @@ -183,14 +184,18 @@ struct point_type template struct point_type { - typedef typename core_dispatch::point_type + using type = typename core_dispatch::point_type < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + tag_t, + util::remove_cptrref_t + >::type; }; +template +using point_type_t = typename point_type::type; + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/radius.hpp b/include/boost/geometry/core/radius.hpp index 0033c3d4a8..984f61a9e9 100644 --- a/include/boost/geometry/core/radius.hpp +++ b/include/boost/geometry/core/radius.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014-2020. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. @@ -23,8 +24,7 @@ #include -#include - +#include #include #include #include @@ -79,18 +79,27 @@ namespace core_dispatch template struct radius_type { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //typedef core_dispatch_specialization_required type; }; /*! \brief radius access meta-functions, used by concept n-sphere and upcoming ellipse. */ -template +template +< + typename Tag, + typename Geometry, + std::size_t Dimension, + bool IsPointer +> struct radius_access { + BOOST_GEOMETRY_STATIC_ASSERT_FALSE( + "Not implemented for this Geometry Tag type.", + Geometry, Tag); //static inline CoordinateType get(Geometry const& ) {} //static inline void set(Geometry& g, CoordinateType const& value) {} }; @@ -107,13 +116,18 @@ struct radius_access template struct radius_type { - typedef typename core_dispatch::radius_type - < - typename tag::type, - typename util::remove_cptrref::type - >::type type; + using type = typename core_dispatch::radius_type + < + tag_t, + util::remove_cptrref_t + >::type; }; + +template +using radius_type_t = typename radius_type::type; + + /*! \brief Function to get radius of a circle / sphere / ellipse / etc. \return radius The radius for a given axis @@ -122,15 +136,15 @@ struct radius_type \tparam I index of the axis */ template -inline typename radius_type::type get_radius(Geometry const& geometry) +inline radius_type_t get_radius(Geometry const& geometry) { return core_dispatch::radius_access - < - typename tag::type, - typename util::remove_cptrref::type, - I, - typename std::is_pointer::type - >::get(geometry); + < + tag_t, + util::remove_cptrref_t, + I, + std::is_pointer::value + >::get(geometry); } /*! @@ -142,14 +156,14 @@ inline typename radius_type::type get_radius(Geometry const& geometry) */ template inline void set_radius(Geometry& geometry, - typename radius_type::type const& radius) + radius_type_t const& radius) { core_dispatch::radius_access < - typename tag::type, - typename util::remove_cptrref::type, + tag_t, + util::remove_cptrref_t, I, - typename std::is_pointer::type + std::is_pointer::value >::set(geometry, radius); } @@ -162,12 +176,12 @@ namespace detail template struct radius_access { - static inline typename radius_type::type get(Geometry const& geometry) + static inline radius_type_t get(Geometry const& geometry) { return traits::radius_access::get(geometry); } static inline void set(Geometry& geometry, - typename radius_type::type const& value) + radius_type_t const& value) { traits::radius_access::set(geometry, value); } @@ -181,33 +195,34 @@ struct radius_access namespace core_dispatch { -template -struct radius_access +template +< + typename Tag, + typename Geometry, + std::size_t Dimension +> +struct radius_access { - typedef typename geometry::radius_type::type radius_type; - - static inline radius_type get(const Geometry * geometry) + static inline radius_type_t get(const Geometry * geometry) { return radius_access - < - Tag, - Geometry, - Dimension, - typename std::is_pointer::type - >::get(*geometry); + < + Tag, + Geometry, + Dimension, + std::is_pointer::value + >::get(*geometry); } - static inline void set(Geometry * geometry, radius_type const& value) + static inline void set(Geometry * geometry, radius_type_t const& value) { return radius_access - < - Tag, - Geometry, - Dimension, - typename std::is_pointer::type - >::set(*geometry, value); + < + Tag, + Geometry, + Dimension, + std::is_pointer::value + >::set(*geometry, value); } }; @@ -215,11 +230,11 @@ struct radius_access template struct radius_type { - typedef typename traits::radius_type::type type; + using type = typename traits::radius_type::type; }; template -struct radius_access +struct radius_access : detail::radius_access { //BOOST_STATIC_ASSERT(Dimension == 0); @@ -229,11 +244,11 @@ struct radius_access template struct radius_type { - typedef typename traits::radius_type::type type; + using type = typename traits::radius_type::type; }; template -struct radius_access +struct radius_access : detail::radius_access { //BOOST_STATIC_ASSERT(Dimension == 0 || Dimension == 2); diff --git a/include/boost/geometry/core/reverse_dispatch.hpp b/include/boost/geometry/core/reverse_dispatch.hpp index 8d43f2fb48..8d27b43a04 100644 --- a/include/boost/geometry/core/reverse_dispatch.hpp +++ b/include/boost/geometry/core/reverse_dispatch.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -57,8 +58,8 @@ struct reverse_dispatch : std::false_type {}; template struct reverse_dispatch : detail::reverse_dispatch < - geometry_id::type::value, - geometry_id::type::value + geometry_id::value, + geometry_id::value > {}; diff --git a/include/boost/geometry/core/ring_type.hpp b/include/boost/geometry/core/ring_type.hpp index 4aca0719ca..eea52ec3ff 100644 --- a/include/boost/geometry/core/ring_type.hpp +++ b/include/boost/geometry/core/ring_type.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2015-2021. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates. @@ -201,24 +202,30 @@ struct ring_type template struct ring_type { - typedef typename core_dispatch::ring_type + using type = typename core_dispatch::ring_type < typename tag::type, Geometry - >::type type; + >::type; }; +template +using ring_type_t = typename ring_type::type; + template struct ring_return_type { - typedef typename core_dispatch::ring_return_type + using type = typename core_dispatch::ring_return_type < typename tag::type, Geometry - >::type type; + >::type; }; +template +using ring_return_type_t = typename ring_return_type::type; + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/tag.hpp b/include/boost/geometry/core/tag.hpp index a33856e9af..196741562c 100644 --- a/include/boost/geometry/core/tag.hpp +++ b/include/boost/geometry/core/tag.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020 Oracle and/or its affiliates. @@ -62,12 +63,17 @@ struct tag template struct tag { - typedef typename traits::tag + using type = typename traits::tag < - typename util::remove_cptrref::type - >::type type; + util::remove_cptrref_t + >::type; }; + +template +using tag_t = typename tag::type; + + }} // namespace boost::geometry #endif // BOOST_GEOMETRY_CORE_TAG_HPP diff --git a/include/boost/geometry/core/tag_cast.hpp b/include/boost/geometry/core/tag_cast.hpp index 18c403b5f3..58dd9912a8 100644 --- a/include/boost/geometry/core/tag_cast.hpp +++ b/include/boost/geometry/core/tag_cast.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. @@ -41,15 +42,14 @@ namespace boost { namespace geometry template struct tag_cast { - typedef Tag type; + using type = Tag; }; #ifndef DOXYGEN_NO_SPECIALIZATIONS template struct tag_cast -{ - typedef std::conditional_t + : std::conditional < std::is_base_of::value, BaseTag, @@ -57,12 +57,16 @@ struct tag_cast < Tag, BaseTags... >::type - > type; -}; + > +{}; #endif // DOXYGEN_NO_SPECIALIZATIONS +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/core/tags.hpp b/include/boost/geometry/core/tags.hpp index 6220f8f174..f0d62783b8 100644 --- a/include/boost/geometry/core/tags.hpp +++ b/include/boost/geometry/core/tags.hpp @@ -152,6 +152,9 @@ struct single_tag_of #endif +template +using single_tag_of_t = typename single_tag_of::type; + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/topological_dimension.hpp b/include/boost/geometry/core/topological_dimension.hpp index a4bc16eb4d..c1c7502466 100644 --- a/include/boost/geometry/core/topological_dimension.hpp +++ b/include/boost/geometry/core/topological_dimension.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2020-2022. // Modifications copyright (c) 2020-2022, Oracle and/or its affiliates. @@ -102,6 +103,12 @@ struct topological_dimension : core_dispatch::top_dim::type> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr int topological_dimension_v = topological_dimension::value; +#endif + + }} // namespace boost::geometry diff --git a/include/boost/geometry/util/type_traits.hpp b/include/boost/geometry/util/type_traits.hpp index c58b5bad02..ef9d1979f6 100644 --- a/include/boost/geometry/util/type_traits.hpp +++ b/include/boost/geometry/util/type_traits.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2020-2021, Oracle and/or its affiliates. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -26,86 +27,130 @@ namespace util template struct is_geometry - : bool_constant::type>::value> + : bool_constant>::value> {}; template struct is_not_geometry - : std::is_void::type> + : std::is_void> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_geometry_v = is_geometry::value; +template +inline constexpr bool is_not_geometry_v = is_not_geometry::value; +#endif + template struct is_point - : std::is_same::type> + : std::is_same> {}; template struct is_multi_point - : std::is_same::type> + : std::is_same> {}; template struct is_pointlike - : std::is_base_of::type> + : std::is_base_of> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_point_v = is_point::value; +template +inline constexpr bool is_multi_point_v = is_multi_point::value; +template +inline constexpr bool is_pointlike_v = is_pointlike::value; +#endif + template struct is_segment - : std::is_same::type> + : std::is_same> {}; template struct is_linestring - : std::is_same::type> + : std::is_same> {}; template struct is_multi_linestring - : std::is_same::type> + : std::is_same> {}; template struct is_polylinear - : std::is_base_of::type> + : std::is_base_of> {}; template struct is_linear - : std::is_base_of::type> + : std::is_base_of> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_segment_v = is_segment::value; +template +inline constexpr bool is_linestring_v = is_linestring::value; +template +inline constexpr bool is_multi_linestring_v = is_multi_linestring::value; +template +inline constexpr bool is_polylinear_v = is_polylinear::value; +template +inline constexpr bool is_linear_v = is_linear::value; +#endif + template struct is_box - : std::is_same::type> + : std::is_same> {}; template struct is_ring - : std::is_same::type> + : std::is_same> {}; template struct is_polygon - : std::is_same::type> + : std::is_same> {}; template struct is_multi_polygon - : std::is_same::type> + : std::is_same> {}; template struct is_polygonal - : std::is_base_of::type> + : std::is_base_of> {}; template struct is_areal - : std::is_base_of::type> + : std::is_base_of> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_box_v = is_box::value; +template +inline constexpr bool is_ring_v = is_ring::value; +template +inline constexpr bool is_polygon_v = is_polygon::value; +template +inline constexpr bool is_multi_polygon_v = is_multi_polygon::value; +template +inline constexpr bool is_polygonal_v = is_polygonal::value; +template +inline constexpr bool is_areal_v = is_areal::value; +#endif + template struct is_segmental @@ -117,36 +162,48 @@ struct is_polysegmental : bool_constant::value || is_polygonal::value> {}; - template struct is_multi - : std::is_base_of::type> + : std::is_base_of> {}; - template struct is_multi_element : bool_constant::value || is_linestring::value || is_polygon::value> {}; - template struct is_single - : std::is_base_of::type> + : std::is_base_of> {}; - template struct is_geometry_collection - : std::is_same::type> + : std::is_same> {}; - template struct is_dynamic_geometry - : std::is_same::type> + : std::is_same> {}; +#ifndef BOOST_NO_CXX17_INLINE_VARIABLES +template +inline constexpr bool is_segmental_v = is_segmental::value; +template +inline constexpr bool is_polysegmental_v = is_polysegmental::value; +template +inline constexpr bool is_multi_v = is_multi::value; +template +inline constexpr bool is_multi_element_v = is_multi_element::value; +template +inline constexpr bool is_single_v = is_single::value; +template +inline constexpr bool is_geometry_collection_v = is_geometry_collection::value; +template +inline constexpr bool is_dynamic_geometry_v = is_dynamic_geometry::value; +#endif + template struct enable_if_point @@ -307,7 +364,8 @@ using enable_if_geometry_collection_t = typename enable_if_geometry_collection +using is_areal [[deprecated("Use util::is_areal<> instead.")]] = util::is_areal; }} // namespace boost::geometry diff --git a/include/boost/geometry/util/type_traits_std.hpp b/include/boost/geometry/util/type_traits_std.hpp index ebff13b3e7..3773feac33 100644 --- a/include/boost/geometry/util/type_traits_std.hpp +++ b/include/boost/geometry/util/type_traits_std.hpp @@ -1,7 +1,8 @@ // Boost.Geometry -// Copyright (c) 2020, Oracle and/or its affiliates. +// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2020, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -54,6 +55,7 @@ struct conjunction : std::conditional_t, Trait> {}; + // C++17 template struct disjunction @@ -68,6 +70,7 @@ struct disjunction : std::conditional_t> {}; + // C++17 template struct negation @@ -195,22 +198,21 @@ using transcribe_cref_t = typename transcribe_cref::type; \endcode */ template -struct add_const_if_c -{ - typedef std::conditional_t +struct [[deprecated("Use util::transcribe_const<> instead.")]] add_const_if_c + : std::conditional < IsConst, Type const, Type - > type; -}; + > +{}; namespace util { template -using bare_type = remove_cptrref; +using bare_type [[deprecated("Use util::remove_cptrref<> instead.")]] = remove_cptrref; } // namespace util