Add alias templates for core and util traits

Add C++17 variable templates for traits behind #ifdef

Use aliases in several algorithms
This commit is contained in:
Adam Wulkiewicz 2024-03-02 23:47:31 +01:00
parent 88d0076ba8
commit 51cf51a25d
26 changed files with 451 additions and 319 deletions

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2023. // This file was modified by Oracle on 2014-2023.
// Modifications copyright (c) 2014-2023, Oracle and/or its affiliates. // 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, static inline void apply(Geometry& geometry, Point const& point,
signed_size_type = -1, signed_size_type = 0) signed_size_type = -1, signed_size_type = 0)
{ {
typename geometry::point_type<Geometry>::type copy; geometry::point_type_t<Geometry> copy;
geometry::detail::conversion::convert_point_to_point(point, copy); geometry::detail::conversion::convert_point_to_point(point, copy);
traits::push_back<Geometry>::apply(geometry, copy); traits::push_back<Geometry>::apply(geometry, copy);
} }
@ -90,7 +91,7 @@ struct to_polygon_point
static inline void apply(Polygon& polygon, Point const& point, static inline void apply(Polygon& polygon, Point const& point,
signed_size_type ring_index, signed_size_type = 0) signed_size_type ring_index, signed_size_type = 0)
{ {
using ring_type = typename ring_type<Polygon>::type; using ring_type = ring_type_t<Polygon>;
if (ring_index == -1) if (ring_index == -1)
{ {
@ -112,18 +113,16 @@ struct to_polygon_range
static inline void apply(Polygon& polygon, Range const& range, static inline void apply(Polygon& polygon, Range const& range,
signed_size_type ring_index, signed_size_type = 0) signed_size_type ring_index, signed_size_type = 0)
{ {
using ring_type = typename ring_type<Polygon>::type; using ring_type = ring_type_t<Polygon>;
using exterior_ring_type = typename ring_return_type<Polygon>::type;
using interior_ring_range_type = typename interior_return_type<Polygon>::type;
if (ring_index == -1) if (ring_index == -1)
{ {
exterior_ring_type ext_ring = exterior_ring(polygon); auto&& ext_ring = exterior_ring(polygon);
to_range_range::apply<ring_type, Range>(ext_ring, range); to_range_range::apply<ring_type, Range>(ext_ring, range);
} }
else if (ring_index < signed_size_type(num_interior_rings(polygon))) 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<ring_type, Range>(range::at(int_rings, ring_index), range); to_range_range::apply<ring_type, Range>(range::at(int_rings, ring_index), range);
} }
} }
@ -159,8 +158,8 @@ template
< <
typename Geometry, typename Geometry,
typename RangeOrPoint, typename RangeOrPoint,
typename Tag = typename geometry::tag<Geometry>::type, typename Tag = geometry::tag_t<Geometry>,
typename OtherTag = typename geometry::tag<RangeOrPoint>::type typename OtherTag = geometry::tag_t<RangeOrPoint>
> >
struct append struct append
: detail::append::append_no_action : detail::append::append_no_action

View File

@ -3,7 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // 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. // This file was modified by Oracle on 2017-2023.
// Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates.
@ -131,13 +131,12 @@ namespace dispatch
template template
< <
typename Geometry, typename Geometry,
typename Tag = typename tag<Geometry>::type typename Tag = tag_t<Geometry>
> >
struct area : detail::calculate_null struct area : detail::calculate_null
{ {
template <typename Strategy> template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type static inline auto apply(Geometry const& geometry, Strategy const& strategy)
apply(Geometry const& geometry, Strategy const& strategy)
{ {
return calculate_null::apply return calculate_null::apply
< <
@ -162,8 +161,7 @@ template <typename Polygon>
struct area<Polygon, polygon_tag> : detail::calculate_polygon_sum struct area<Polygon, polygon_tag> : detail::calculate_polygon_sum
{ {
template <typename Strategy> template <typename Strategy>
static inline typename area_result<Polygon, Strategy>::type static inline auto apply(Polygon const& polygon, Strategy const& strategy)
apply(Polygon const& polygon, Strategy const& strategy)
{ {
return calculate_polygon_sum::apply return calculate_polygon_sum::apply
< <
@ -178,8 +176,7 @@ template <typename MultiGeometry>
struct area<MultiGeometry, multi_polygon_tag> : detail::multi_sum struct area<MultiGeometry, multi_polygon_tag> : detail::multi_sum
{ {
template <typename Strategy> template <typename Strategy>
static inline typename area_result<MultiGeometry, Strategy>::type static inline auto apply(MultiGeometry const& multi, Strategy const& strategy)
apply(MultiGeometry const& multi, Strategy const& strategy)
{ {
return multi_sum::apply return multi_sum::apply
< <
@ -205,8 +202,7 @@ template
struct area struct area
{ {
template <typename Geometry> template <typename Geometry>
static inline typename area_result<Geometry, Strategy>::type static inline auto apply(Geometry const& geometry, Strategy const& strategy)
apply(Geometry const& geometry, Strategy const& strategy)
{ {
return dispatch::area<Geometry>::apply(geometry, strategy); return dispatch::area<Geometry>::apply(geometry, strategy);
} }
@ -230,8 +226,7 @@ template <>
struct area<default_strategy, false> struct area<default_strategy, false>
{ {
template <typename Geometry> template <typename Geometry>
static inline typename area_result<Geometry>::type static inline auto apply(Geometry const& geometry, default_strategy)
apply(Geometry const& geometry, default_strategy)
{ {
typedef typename strategies::area::services::default_strategy typedef typename strategies::area::services::default_strategy
< <
@ -249,12 +244,11 @@ struct area<default_strategy, false>
namespace resolve_dynamic namespace resolve_dynamic
{ {
template <typename Geometry, typename Tag = typename geometry::tag<Geometry>::type> template <typename Geometry, typename Tag = geometry::tag_t<Geometry>>
struct area struct area
{ {
template <typename Strategy> template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type static inline auto apply(Geometry const& geometry, Strategy const& strategy)
apply(Geometry const& geometry, Strategy const& strategy)
{ {
return resolve_strategy::area<Strategy>::apply(geometry, strategy); return resolve_strategy::area<Strategy>::apply(geometry, strategy);
} }
@ -264,8 +258,7 @@ template <typename Geometry>
struct area<Geometry, dynamic_geometry_tag> struct area<Geometry, dynamic_geometry_tag>
{ {
template <typename Strategy> template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type static inline auto apply(Geometry const& geometry, Strategy const& strategy)
apply(Geometry const& geometry, Strategy const& strategy)
{ {
typename area_result<Geometry, Strategy>::type result = 0; typename area_result<Geometry, Strategy>::type result = 0;
traits::visit<Geometry>::apply([&](auto const& g) traits::visit<Geometry>::apply([&](auto const& g)
@ -280,8 +273,7 @@ template <typename Geometry>
struct area<Geometry, geometry_collection_tag> struct area<Geometry, geometry_collection_tag>
{ {
template <typename Strategy> template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type static inline auto apply(Geometry const& geometry, Strategy const& strategy)
apply(Geometry const& geometry, Strategy const& strategy)
{ {
typename area_result<Geometry, Strategy>::type result = 0; typename area_result<Geometry, Strategy>::type result = 0;
detail::visit_breadth_first([&](auto const& g) detail::visit_breadth_first([&](auto const& g)
@ -318,8 +310,7 @@ and Geographic as well.
\qbk{[area] [area_output]} \qbk{[area] [area_output]}
*/ */
template <typename Geometry> template <typename Geometry>
inline typename area_result<Geometry>::type inline auto area(Geometry const& geometry)
area(Geometry const& geometry)
{ {
concepts::check<Geometry const>(); concepts::check<Geometry const>();
@ -354,8 +345,7 @@ area(Geometry const& geometry)
} }
*/ */
template <typename Geometry, typename Strategy> template <typename Geometry, typename Strategy>
inline typename area_result<Geometry, Strategy>::type inline auto area(Geometry const& geometry, Strategy const& strategy)
area(Geometry const& geometry, Strategy const& strategy)
{ {
concepts::check<Geometry const>(); concepts::check<Geometry const>();

View File

@ -4,6 +4,7 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2014 Samuel Debionne, Grenoble, France. // Copyright (c) 2014 Samuel Debionne, Grenoble, France.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020-2023. // This file was modified by Oracle on 2020-2023.
// Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates.
@ -91,7 +92,7 @@ inline void assign_inverse(Geometry& geometry)
dispatch::assign_inverse dispatch::assign_inverse
< <
typename tag<Geometry>::type, tag_t<Geometry>,
Geometry Geometry
>::apply(geometry); >::apply(geometry);
} }
@ -111,7 +112,7 @@ inline void assign_zero(Geometry& geometry)
dispatch::assign_zero dispatch::assign_zero
< <
typename tag<Geometry>::type, tag_t<Geometry>,
Geometry Geometry
>::apply(geometry); >::apply(geometry);
} }
@ -141,9 +142,9 @@ inline void assign_values(Geometry& geometry, Type const& c1, Type const& c2)
dispatch::assign dispatch::assign
< <
typename tag<Geometry>::type, tag_t<Geometry>,
Geometry, Geometry,
geometry::dimension<Geometry>::type::value geometry::dimension<Geometry>::value
>::apply(geometry, c1, c2); >::apply(geometry, c1, c2);
} }
@ -174,9 +175,9 @@ inline void assign_values(Geometry& geometry,
dispatch::assign dispatch::assign
< <
typename tag<Geometry>::type, tag_t<Geometry>,
Geometry, Geometry,
geometry::dimension<Geometry>::type::value geometry::dimension<Geometry>::value
>::apply(geometry, c1, c2, c3); >::apply(geometry, c1, c2, c3);
} }
@ -201,9 +202,9 @@ inline void assign_values(Geometry& geometry,
dispatch::assign dispatch::assign
< <
typename tag<Geometry>::type, tag_t<Geometry>,
Geometry, Geometry,
geometry::dimension<Geometry>::type::value geometry::dimension<Geometry>::value
>::apply(geometry, c1, c2, c3, c4); >::apply(geometry, c1, c2, c3, c4);
} }

View File

@ -3,7 +3,7 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // 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. // This file was modified by Oracle on 2014-2023.
// Modifications copyright (c) 2014-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2023 Oracle and/or its affiliates.
@ -184,7 +184,7 @@ struct centroid_range_state
typename PointTransformer::result_type typename PointTransformer::result_type
pt = transformer.apply(*it); pt = transformer.apply(*it);
using point_type = typename geometry::point_type<Ring const>::type; using point_type = geometry::point_type_t<Ring const>;
strategy.apply(static_cast<point_type const&>(previous_pt), strategy.apply(static_cast<point_type const&>(previous_pt),
static_cast<point_type const&>(pt), static_cast<point_type const&>(pt),
state); state);
@ -208,7 +208,7 @@ struct centroid_range
typename Strategy::template state_type typename Strategy::template state_type
< <
typename geometry::point_type<Range>::type, geometry::point_type_t<Range>,
Point Point
>::type state; >::type state;
@ -265,7 +265,7 @@ struct centroid_polygon
typename Strategy::template state_type typename Strategy::template state_type
< <
typename geometry::point_type<Polygon>::type, geometry::point_type_t<Polygon>,
Point Point
>::type state; >::type state;
@ -333,7 +333,7 @@ struct centroid_multi
typename Strategy::template state_type typename Strategy::template state_type
< <
typename geometry::point_type<Multi>::type, geometry::point_type_t<Multi>,
Point Point
>::type state; >::type state;
@ -393,7 +393,7 @@ namespace dispatch
template template
< <
typename Geometry, typename Geometry,
typename Tag = typename tag<Geometry>::type typename Tag = tag_t<Geometry>
> >
struct centroid: not_implemented<Tag> struct centroid: not_implemented<Tag>
{}; {};
@ -511,10 +511,10 @@ struct centroid<default_strategy, false>
template <typename Geometry, typename Point> template <typename Geometry, typename Point>
static inline void apply(Geometry const& geometry, Point& out, default_strategy) 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 Geometry
>::type strategies_type; >::type;
dispatch::centroid<Geometry>::apply(geometry, out, strategies_type()); dispatch::centroid<Geometry>::apply(geometry, out, strategies_type());
} }
@ -525,7 +525,7 @@ struct centroid<default_strategy, false>
namespace resolve_dynamic { namespace resolve_dynamic {
template <typename Geometry, typename Tag = typename tag<Geometry>::type> template <typename Geometry, typename Tag = tag_t<Geometry>>
struct centroid struct centroid
{ {
template <typename Point, typename Strategy> template <typename Point, typename Strategy>

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020-2023. // This file was modified by Oracle on 2020-2023.
// Modifications copyright (c) 2020-2023, Oracle and/or its affiliates. // Modifications copyright (c) 2020-2023, Oracle and/or its affiliates.
@ -56,17 +57,17 @@ struct polygon_clear
{ {
traits::clear traits::clear
< <
typename std::remove_reference std::remove_reference_t
< <
typename traits::interior_mutable_type<Polygon>::type typename traits::interior_mutable_type<Polygon>::type
>::type >
>::apply(interior_rings(polygon)); >::apply(interior_rings(polygon));
traits::clear traits::clear
< <
typename std::remove_reference std::remove_reference_t
< <
typename traits::ring_mutable_type<Polygon>::type typename traits::ring_mutable_type<Polygon>::type
>::type >
>::apply(exterior_ring(polygon)); >::apply(exterior_ring(polygon));
} }
}; };
@ -90,7 +91,7 @@ namespace dispatch
template template
< <
typename Geometry, typename Geometry,
typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type typename Tag = tag_cast_t<tag_t<Geometry>, multi_tag>
> >
struct clear: not_implemented<Tag> struct clear: not_implemented<Tag>
{}; {};

View File

@ -3,7 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // 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. // This file was modified by Oracle on 2017-2023.
// Modifications copyright (c) 2017-2023, Oracle and/or its affiliates. // 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) static inline void apply(Point const& point, Box& box)
{ {
typedef typename coordinate_type<Box>::type coordinate_type;
set<Index, Dimension>(box, set<Index, Dimension>(box,
util::numeric_cast<coordinate_type>(get<Dimension>(point))); util::numeric_cast<coordinate_type_t<Box>>(get<Dimension>(point)));
point_to_box point_to_box
< <
Point, Box, Point, Box,
@ -171,8 +169,7 @@ struct range_to_range
// point for open output. // point for open output.
view_type const view(source); view_type const view(source);
typedef typename boost::range_size<Range1>::type size_type; auto n = boost::size(view);
size_type n = boost::size(view);
if (geometry::closure<Range2>::value == geometry::open) if (geometry::closure<Range2>::value == geometry::open)
{ {
n--; n--;
@ -181,7 +178,7 @@ struct range_to_range
// If size == 0 && geometry::open <=> n = numeric_limits<size_type>::max() // If size == 0 && geometry::open <=> n = numeric_limits<size_type>::max()
// but ok, sice below it == end() // but ok, sice below it == end()
size_type i = 0; decltype(n) i = 0;
for (auto it = boost::begin(view); for (auto it = boost::begin(view);
it != boost::end(view) && i < n; it != boost::end(view) && i < n;
++it, ++i) ++it, ++i)
@ -198,13 +195,12 @@ struct range_to_range
template <typename Polygon1, typename Polygon2> template <typename Polygon1, typename Polygon2>
struct polygon_to_polygon struct polygon_to_polygon
{ {
typedef range_to_range using per_ring = range_to_range
< <
typename geometry::ring_type<Polygon1>::type, geometry::ring_type_t<Polygon1>,
typename geometry::ring_type<Polygon2>::type, geometry::ring_type_t<Polygon2>,
geometry::point_order<Polygon1>::value geometry::point_order<Polygon1>::value != geometry::point_order<Polygon2>::value
!= geometry::point_order<Polygon2>::value >;
> per_ring;
static inline void apply(Polygon1 const& source, Polygon2& destination) static inline void apply(Polygon1 const& source, Polygon2& destination)
{ {
@ -216,10 +212,10 @@ struct polygon_to_polygon
// Container should be resizeable // Container should be resizeable
traits::resize traits::resize
< <
typename std::remove_reference std::remove_reference_t
< <
typename traits::interior_mutable_type<Polygon2>::type typename traits::interior_mutable_type<Polygon2>::type
>::type >
>::apply(interior_rings(destination), num_interior_rings(source)); >::apply(interior_rings(destination), num_interior_rings(source));
auto const& rings_source = interior_rings(source); auto const& rings_source = interior_rings(source);
@ -280,9 +276,9 @@ namespace dispatch
template template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type, typename Tag1 = tag_cast_t<tag_t<Geometry1>, multi_tag>,
typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type, typename Tag2 = tag_cast_t<tag_t<Geometry2>, multi_tag>,
std::size_t DimensionCount = dimension<Geometry1>::type::value, std::size_t DimensionCount = dimension<Geometry1>::value,
bool UseAssignment = std::is_same<Geometry1, Geometry2>::value bool UseAssignment = std::is_same<Geometry1, Geometry2>::value
&& !std::is_array<Geometry1>::value && !std::is_array<Geometry1>::value
> >
@ -353,8 +349,7 @@ struct convert<Ring1, Ring2, ring_tag, ring_tag, DimensionCount, false>
< <
Ring1, Ring1,
Ring2, Ring2,
geometry::point_order<Ring1>::value geometry::point_order<Ring1>::value != geometry::point_order<Ring2>::value
!= geometry::point_order<Ring2>::value
> >
{}; {};
@ -461,14 +456,8 @@ struct convert<Multi1, Multi2, multi_tag, multi_tag, DimensionCount, false>
< <
typename boost::range_value<Multi1>::type, typename boost::range_value<Multi1>::type,
typename boost::range_value<Multi2>::type, typename boost::range_value<Multi2>::type,
typename single_tag_of single_tag_of_t<tag_t<Multi1>>,
< single_tag_of_t<tag_t<Multi2>>,
typename tag<Multi1>::type
>::type,
typename single_tag_of
<
typename tag<Multi2>::type
>::type,
DimensionCount DimensionCount
> >
> >
@ -485,11 +474,8 @@ struct convert<Single, Multi, SingleTag, multi_tag, DimensionCount, false>
< <
Single, Single,
typename boost::range_value<Multi>::type, typename boost::range_value<Multi>::type,
typename tag<Single>::type, tag_t<Single>,
typename single_tag_of single_tag_of_t<tag_t<Multi>>,
<
typename tag<Multi>::type
>::type,
DimensionCount, DimensionCount,
false false
> >

View File

@ -3,7 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // 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. // This file was modified by Oracle on 2017-2023.
// Modifications copyright (c) 2017-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2023 Oracle and/or its affiliates.
@ -75,8 +75,6 @@ struct correct_box
template <typename Box, typename Strategy> template <typename Box, typename Strategy>
static inline void apply(Box& box, Strategy const& ) static inline void apply(Box& box, Strategy const& )
{ {
using coordinate_type = typename geometry::coordinate_type<Box>::type;
// Currently only for Cartesian coordinates // Currently only for Cartesian coordinates
// (or spherical without crossing dateline) // (or spherical without crossing dateline)
// Future version: adapt using strategies // Future version: adapt using strategies
@ -85,8 +83,8 @@ struct correct_box
if (get<min_corner, dimension>(box) > get<max_corner, dimension>(box)) if (get<min_corner, dimension>(box) > get<max_corner, dimension>(box))
{ {
// Swap the coordinates // Swap the coordinates
coordinate_type max_value = get<min_corner, dimension>(box); auto max_value = get<min_corner, dimension>(box);
coordinate_type min_value = get<max_corner, dimension>(box); auto min_value = get<max_corner, dimension>(box);
set<min_corner, dimension>(box, min_value); set<min_corner, dimension>(box, min_value);
set<max_corner, dimension>(box, max_value); set<max_corner, dimension>(box, max_value);
} }
@ -144,7 +142,7 @@ struct correct_polygon
namespace dispatch namespace dispatch
{ {
template <typename Geometry, typename Tag = typename tag<Geometry>::type> template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct: not_implemented<Tag> struct correct: not_implemented<Tag>
{}; {};
@ -252,7 +250,7 @@ struct correct<default_strategy, false>
namespace resolve_dynamic namespace resolve_dynamic
{ {
template <typename Geometry, typename Tag = typename tag<Geometry>::type> template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct struct correct
{ {
template <typename Strategy> template <typename Strategy>

View File

@ -1,6 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020-2023. // This file was modified by Oracle on 2020-2023.
// Modifications copyright (c) 2020-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates.
@ -102,7 +103,7 @@ struct close_or_open_polygon
namespace dispatch namespace dispatch
{ {
template <typename Geometry, typename Tag = typename tag<Geometry>::type> template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct_closure: not_implemented<Tag> struct correct_closure: not_implemented<Tag>
{}; {};
@ -166,7 +167,7 @@ struct correct_closure<Geometry, multi_polygon_tag>
namespace resolve_variant namespace resolve_variant
{ {
template <typename Geometry, typename Tag = typename tag<Geometry>::type> template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct_closure struct correct_closure
{ {
static inline void apply(Geometry& geometry) static inline void apply(Geometry& geometry)

View File

@ -3,6 +3,7 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
@ -75,7 +76,12 @@ struct access
\ingroup traits \ingroup traits
*/ */
template <typename Geometry, std::size_t Index, std::size_t Dimension> template <typename Geometry, std::size_t Index, std::size_t Dimension>
struct indexed_access {}; struct indexed_access
{
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
"Not implemented for this Geometry type.",
Geometry);
};
} // namespace traits } // namespace traits
@ -87,17 +93,16 @@ namespace detail
template template
< <
typename Geometry, typename Geometry,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension std::size_t Dimension
> >
struct indexed_access_non_pointer struct indexed_access_non_pointer
{ {
static constexpr CoordinateType get(Geometry const& geometry) static constexpr coordinate_type_t<Geometry> get(Geometry const& geometry)
{ {
return traits::indexed_access<Geometry, Index, Dimension>::get(geometry); return traits::indexed_access<Geometry, Index, Dimension>::get(geometry);
} }
static void set(Geometry& b, CoordinateType const& value) static void set(Geometry& b, coordinate_type_t<Geometry> const& value)
{ {
traits::indexed_access<Geometry, Index, Dimension>::set(b, value); traits::indexed_access<Geometry, Index, Dimension>::set(b, value);
} }
@ -106,19 +111,18 @@ struct indexed_access_non_pointer
template template
< <
typename Geometry, typename Geometry,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension std::size_t Dimension
> >
struct indexed_access_pointer struct indexed_access_pointer
{ {
static constexpr CoordinateType get(Geometry const* geometry) static constexpr coordinate_type_t<Geometry> get(Geometry const* geometry)
{ {
return traits::indexed_access<typename std::remove_pointer<Geometry>::type, Index, Dimension>::get(*geometry); return traits::indexed_access<std::remove_pointer_t<Geometry>, Index, Dimension>::get(*geometry);
} }
static void set(Geometry* geometry, CoordinateType const& value) static void set(Geometry* geometry, coordinate_type_t<Geometry> const& value)
{ {
traits::indexed_access<typename std::remove_pointer<Geometry>::type, Index, Dimension>::set(*geometry, value); traits::indexed_access<std::remove_pointer_t<Geometry>, Index, Dimension>::set(*geometry, value);
} }
}; };
@ -135,13 +139,14 @@ template
< <
typename Tag, typename Tag,
typename Geometry, typename Geometry,
typename
CoordinateType,
std::size_t Dimension, std::size_t Dimension,
typename IsPointer bool IsPointer
> >
struct access struct access
{ {
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
"Not implemented for this Geometry Tag type.",
Geometry, Tag);
//static inline T get(G const&) {} //static inline T get(G const&) {}
//static inline void set(G& g, T const& value) {} //static inline void set(G& g, T const& value) {}
}; };
@ -150,40 +155,42 @@ template
< <
typename Tag, typename Tag,
typename Geometry, typename Geometry,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension, std::size_t Dimension,
typename IsPointer bool IsPointer
> >
struct indexed_access 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 T get(G const&) {}
//static inline void set(G& g, T const& value) {} //static inline void set(G& g, T const& value) {}
}; };
template <typename Point, typename CoordinateType, std::size_t Dimension> template <typename Point, std::size_t Dimension>
struct access<point_tag, Point, CoordinateType, Dimension, std::false_type> struct access<point_tag, Point, Dimension, false>
{ {
static constexpr CoordinateType get(Point const& point) static constexpr coordinate_type_t<Point> get(Point const& point)
{ {
return traits::access<Point, Dimension>::get(point); return traits::access<Point, Dimension>::get(point);
} }
static void set(Point& p, CoordinateType const& value) static void set(Point& p, coordinate_type_t<Point> const& value)
{ {
traits::access<Point, Dimension>::set(p, value); traits::access<Point, Dimension>::set(p, value);
} }
}; };
template <typename Point, typename CoordinateType, std::size_t Dimension> template <typename Point, std::size_t Dimension>
struct access<point_tag, Point, CoordinateType, Dimension, std::true_type> struct access<point_tag, Point, Dimension, true>
{ {
static constexpr CoordinateType get(Point const* point) static constexpr coordinate_type_t<Point> get(Point const* point)
{ {
return traits::access<typename std::remove_pointer<Point>::type, Dimension>::get(*point); return traits::access<std::remove_pointer_t<Point>, Dimension>::get(*point);
} }
static void set(Point* p, CoordinateType const& value) static void set(Point* p, coordinate_type_t<Point> const& value)
{ {
traits::access<typename std::remove_pointer<Point>::type, Dimension>::set(*p, value); traits::access<std::remove_pointer_t<Point>, Dimension>::set(*p, value);
} }
}; };
@ -191,47 +198,43 @@ struct access<point_tag, Point, CoordinateType, Dimension, std::true_type>
template template
< <
typename Box, typename Box,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension std::size_t Dimension
> >
struct indexed_access<box_tag, Box, CoordinateType, Index, Dimension, std::false_type> struct indexed_access<box_tag, Box, Index, Dimension, false>
: detail::indexed_access_non_pointer<Box, CoordinateType, Index, Dimension> : detail::indexed_access_non_pointer<Box, Index, Dimension>
{}; {};
template template
< <
typename Box, typename Box,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension std::size_t Dimension
> >
struct indexed_access<box_tag, Box, CoordinateType, Index, Dimension, std::true_type> struct indexed_access<box_tag, Box, Index, Dimension, true>
: detail::indexed_access_pointer<Box, CoordinateType, Index, Dimension> : detail::indexed_access_pointer<Box, Index, Dimension>
{}; {};
template template
< <
typename Segment, typename Segment,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension std::size_t Dimension
> >
struct indexed_access<segment_tag, Segment, CoordinateType, Index, Dimension, std::false_type> struct indexed_access<segment_tag, Segment, Index, Dimension, false>
: detail::indexed_access_non_pointer<Segment, CoordinateType, Index, Dimension> : detail::indexed_access_non_pointer<Segment, Index, Dimension>
{}; {};
template template
< <
typename Segment, typename Segment,
typename CoordinateType,
std::size_t Index, std::size_t Index,
std::size_t Dimension std::size_t Dimension
> >
struct indexed_access<segment_tag, Segment, CoordinateType, Index, Dimension, std::true_type> struct indexed_access<segment_tag, Segment, Index, Dimension, true>
: detail::indexed_access_pointer<Segment, CoordinateType, Index, Dimension> : detail::indexed_access_pointer<Segment, Index, Dimension>
{}; {};
} // namespace core_dispatch } // namespace core_dispatch
@ -265,22 +268,19 @@ struct signature_getset_index_dimension {};
\qbk{[include reference/core/get_point.qbk]} \qbk{[include reference/core/get_point.qbk]}
*/ */
template <std::size_t Dimension, typename Geometry> template <std::size_t Dimension, typename Geometry>
constexpr inline typename coordinate_type<Geometry>::type get(Geometry const& geometry constexpr inline coordinate_type_t<Geometry> get(Geometry const& geometry
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_dimension* = 0 , detail::signature_getset_dimension* = 0
#endif #endif
) )
{ {
typedef core_dispatch::access return core_dispatch::access
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type, util::remove_cptrref_t<Geometry>,
typename coordinate_type<Geometry>::type,
Dimension, Dimension,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
> coord_access_type; >::get(geometry);
return coord_access_type::get(geometry);
} }
@ -298,22 +298,19 @@ constexpr inline typename coordinate_type<Geometry>::type get(Geometry const& ge
*/ */
template <std::size_t Dimension, typename Geometry> template <std::size_t Dimension, typename Geometry>
inline void set(Geometry& geometry inline void set(Geometry& geometry
, typename coordinate_type<Geometry>::type const& value , coordinate_type_t<Geometry> const& value
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_dimension* = 0 , detail::signature_getset_dimension* = 0
#endif #endif
) )
{ {
typedef core_dispatch::access core_dispatch::access
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type, util::remove_cptrref_t<Geometry>,
typename coordinate_type<Geometry>::type,
Dimension, Dimension,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
> coord_access_type; >::set(geometry, value);
coord_access_type::set(geometry, value);
} }
@ -331,23 +328,20 @@ inline void set(Geometry& geometry
\qbk{[include reference/core/get_box.qbk]} \qbk{[include reference/core/get_box.qbk]}
*/ */
template <std::size_t Index, std::size_t Dimension, typename Geometry> template <std::size_t Index, std::size_t Dimension, typename Geometry>
constexpr inline typename coordinate_type<Geometry>::type get(Geometry const& geometry constexpr inline coordinate_type_t<Geometry> get(Geometry const& geometry
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_index_dimension* = 0 , detail::signature_getset_index_dimension* = 0
#endif #endif
) )
{ {
typedef core_dispatch::indexed_access return core_dispatch::indexed_access
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type, util::remove_cptrref_t<Geometry>,
typename coordinate_type<Geometry>::type,
Index, Index,
Dimension, Dimension,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
> coord_access_type; >::get(geometry);
return coord_access_type::get(geometry);
} }
/*! /*!
@ -366,23 +360,20 @@ constexpr inline typename coordinate_type<Geometry>::type get(Geometry const& ge
*/ */
template <std::size_t Index, std::size_t Dimension, typename Geometry> template <std::size_t Index, std::size_t Dimension, typename Geometry>
inline void set(Geometry& geometry inline void set(Geometry& geometry
, typename coordinate_type<Geometry>::type const& value , coordinate_type_t<Geometry> const& value
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_index_dimension* = 0 , detail::signature_getset_index_dimension* = 0
#endif #endif
) )
{ {
typedef core_dispatch::indexed_access core_dispatch::indexed_access
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type, util::remove_cptrref_t<Geometry>,
typename coordinate_type<Geometry>::type,
Index, Index,
Dimension, Dimension,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
> coord_access_type; >::set(geometry, value);
coord_access_type::set(geometry, value);
} }
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,7 +3,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -187,25 +188,33 @@ struct closure<multi_polygon_tag, MultiPolygon>
*/ */
template <typename Geometry> template <typename Geometry>
struct closure struct closure
{ : std::integral_constant
static const closure_selector value = core_dispatch::closure
< <
typename tag<Geometry>::type, closure_selector,
typename util::remove_cptrref<Geometry>::type core_dispatch::closure
>::value; <
}; tag_t<Geometry>,
util::remove_cptrref_t<Geometry>
>::value
>
{};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename Geometry>
inline constexpr closure_selector closure_v = closure<Geometry>::value;
#endif
#ifndef DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DETAIL
namespace detail namespace detail
{ {
template template <typename Geometry>
< using minimum_ring_size = core_detail::closure::minimum_ring_size
typename Geometry, <
closure_selector Closure = geometry::closure<Geometry>::value geometry::closure<Geometry>::value
> >;
using minimum_ring_size = core_detail::closure::minimum_ring_size<Closure>;
} // namespace detail } // namespace detail
#endif // DOXYGEN_NO_DETAIL #endif // DOXYGEN_NO_DETAIL

View File

@ -3,6 +3,7 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
@ -88,11 +89,18 @@ template <typename Geometry>
struct dimension struct dimension
: core_dispatch::dimension : core_dispatch::dimension
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type util::remove_cptrref_t<Geometry>
> >
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename Geometry>
inline constexpr std::size_t dimension_v = dimension<Geometry>::value;
#endif
/*! /*!
\brief assert_dimension, enables compile-time checking if coordinate dimensions are as expected \brief assert_dimension, enables compile-time checking if coordinate dimensions are as expected
\ingroup utility \ingroup utility

View File

@ -3,6 +3,7 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
@ -88,14 +89,18 @@ namespace core_dispatch
template <typename Geometry> template <typename Geometry>
struct coordinate_system struct coordinate_system
{ {
typedef typename core_dispatch::coordinate_system using type = typename core_dispatch::coordinate_system
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type util::remove_cptrref_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using coordinate_system_t = typename coordinate_system<Geometry>::type;
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,6 +3,7 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
@ -56,19 +57,21 @@ namespace core_dispatch
template <typename GeometryTag, typename Geometry> template <typename GeometryTag, typename Geometry>
struct coordinate_type struct coordinate_type
{ {
typedef typename point_type<GeometryTag, Geometry>::type point_type;
// Call its own specialization on point-tag // Call its own specialization on point-tag
typedef typename coordinate_type<point_tag, point_type>::type type; using type = typename coordinate_type
<
point_tag,
typename point_type<GeometryTag, Geometry>::type
>::type;
}; };
template <typename Point> template <typename Point>
struct coordinate_type<point_tag, Point> struct coordinate_type<point_tag, Point>
{ {
typedef typename traits::coordinate_type using type = typename traits::coordinate_type
< <
typename util::remove_cptrref<Point>::type util::remove_cptrref_t<Point>
>::type type; >::type;
}; };
@ -86,13 +89,18 @@ struct coordinate_type<point_tag, Point>
template <typename Geometry> template <typename Geometry>
struct coordinate_type struct coordinate_type
{ {
typedef typename core_dispatch::coordinate_type using type = typename core_dispatch::coordinate_type
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type util::remove_cptrref_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using coordinate_type_t = typename coordinate_type<Geometry>::type;
/*! /*!
\brief assert_coordinate_type_equal, a compile-time check for equality of two coordinate types \brief assert_coordinate_type_equal, a compile-time check for equality of two coordinate types
\ingroup utility \ingroup utility
@ -100,11 +108,8 @@ struct coordinate_type
template <typename Geometry1, typename Geometry2> template <typename Geometry1, typename Geometry2>
constexpr inline void assert_coordinate_type_equal(Geometry1 const& , Geometry2 const& ) constexpr inline void assert_coordinate_type_equal(Geometry1 const& , Geometry2 const& )
{ {
static_assert(std::is_same static_assert(std::is_same<coordinate_type_t<Geometry1>, coordinate_type_t<Geometry2>>::value,
< "Coordinate types in geometries should be the same");
typename coordinate_type<Geometry1>::type,
typename coordinate_type<Geometry2>::type
>::value, "Coordinate types in geometries should be the same");
} }
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,10 +3,10 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2020. // This file was modified by Oracle on 2014-2020.
// Modifications copyright (c) 2014-2020, Oracle and/or its affiliates. // 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 Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -237,13 +237,17 @@ struct cs_tag<cs::undefined>
template <typename Geometry> template <typename Geometry>
struct cs_tag struct cs_tag
{ {
typedef typename traits::cs_tag using type = typename traits::cs_tag
< <
typename geometry::coordinate_system<Geometry>::type geometry::coordinate_system_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using cs_tag_t = typename cs_tag<Geometry>::type;
namespace traits namespace traits
{ {
@ -287,13 +291,17 @@ namespace detail
template <typename Geometry> template <typename Geometry>
struct cs_angular_units struct cs_angular_units
{ {
typedef typename traits::cs_angular_units using type = typename traits::cs_angular_units
< <
typename geometry::coordinate_system<Geometry>::type geometry::coordinate_system_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using cs_angular_units_t = typename cs_angular_units<Geometry>::type;
template <typename Units, typename CsTag> template <typename Units, typename CsTag>
struct cs_tag_to_coordinate_system struct cs_tag_to_coordinate_system
{ {
@ -332,6 +340,11 @@ struct cs_tag_to_coordinate_system<Units, geographic_tag>
typedef cs::geographic<Units> type; typedef cs::geographic<Units> type;
}; };
template <typename Units, typename CsTag>
using cs_tag_to_coordinate_system_t = typename cs_tag_to_coordinate_system<Units, CsTag>::type;
} // namespace detail } // namespace detail
#endif // DOXYGEN_NO_DETAIL #endif // DOXYGEN_NO_DETAIL

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates. // Modifications copyright (c) 2020 Oracle and/or its affiliates.
@ -103,6 +104,12 @@ struct geometry_id : core_dispatch::geometry_id<typename tag<Geometry>::type>
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename GeometryTag>
inline constexpr int geometry_id_v = geometry_id<GeometryTag>::value;
#endif
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,10 +3,10 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2020. // This file was modified by Oracle on 2014-2020.
// Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -172,13 +172,23 @@ struct point_order<multi_polygon_tag, MultiPolygon>
*/ */
template <typename Geometry> template <typename Geometry>
struct point_order struct point_order
{ : std::integral_constant
static const order_selector value = core_dispatch::point_order
< <
typename tag<Geometry>::type, order_selector,
typename util::remove_cptrref<Geometry>::type core_dispatch::point_order
>::value; <
}; tag_t<Geometry>,
util::remove_cptrref_t<Geometry>
>::value
>
{};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename Geometry>
inline constexpr order_selector point_order_v = point_order<Geometry>::value;
#endif
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020-2021. // This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates.
@ -183,14 +184,18 @@ struct point_type<geometry_collection_tag, GeometryCollection>
template <typename Geometry> template <typename Geometry>
struct point_type struct point_type
{ {
typedef typename core_dispatch::point_type using type = typename core_dispatch::point_type
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type util::remove_cptrref_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using point_type_t = typename point_type<Geometry>::type;
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2020. // This file was modified by Oracle on 2014-2020.
// Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates.
@ -23,8 +24,7 @@
#include <cstddef> #include <cstddef>
#include <boost/static_assert.hpp> #include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/type_traits_std.hpp> #include <boost/geometry/util/type_traits_std.hpp>
@ -79,18 +79,27 @@ namespace core_dispatch
template <typename Tag, typename Geometry> template <typename Tag, typename Geometry>
struct radius_type struct radius_type
{ {
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
"Not implemented for this Geometry Tag type.",
Geometry, Tag);
//typedef core_dispatch_specialization_required type; //typedef core_dispatch_specialization_required type;
}; };
/*! /*!
\brief radius access meta-functions, used by concept n-sphere and upcoming ellipse. \brief radius access meta-functions, used by concept n-sphere and upcoming ellipse.
*/ */
template <typename Tag, template
typename Geometry, <
std::size_t Dimension, typename Tag,
typename IsPointer> typename Geometry,
std::size_t Dimension,
bool IsPointer
>
struct radius_access 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 CoordinateType get(Geometry const& ) {}
//static inline void set(Geometry& g, CoordinateType const& value) {} //static inline void set(Geometry& g, CoordinateType const& value) {}
}; };
@ -107,13 +116,18 @@ struct radius_access
template <typename Geometry> template <typename Geometry>
struct radius_type struct radius_type
{ {
typedef typename core_dispatch::radius_type using type = typename core_dispatch::radius_type
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type util::remove_cptrref_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using radius_type_t = typename radius_type<Geometry>::type;
/*! /*!
\brief Function to get radius of a circle / sphere / ellipse / etc. \brief Function to get radius of a circle / sphere / ellipse / etc.
\return radius The radius for a given axis \return radius The radius for a given axis
@ -122,15 +136,15 @@ struct radius_type
\tparam I index of the axis \tparam I index of the axis
*/ */
template <std::size_t I, typename Geometry> template <std::size_t I, typename Geometry>
inline typename radius_type<Geometry>::type get_radius(Geometry const& geometry) inline radius_type_t<Geometry> get_radius(Geometry const& geometry)
{ {
return core_dispatch::radius_access return core_dispatch::radius_access
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type, util::remove_cptrref_t<Geometry>,
I, I,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
>::get(geometry); >::get(geometry);
} }
/*! /*!
@ -142,14 +156,14 @@ inline typename radius_type<Geometry>::type get_radius(Geometry const& geometry)
*/ */
template <std::size_t I, typename Geometry> template <std::size_t I, typename Geometry>
inline void set_radius(Geometry& geometry, inline void set_radius(Geometry& geometry,
typename radius_type<Geometry>::type const& radius) radius_type_t<Geometry> const& radius)
{ {
core_dispatch::radius_access core_dispatch::radius_access
< <
typename tag<Geometry>::type, tag_t<Geometry>,
typename util::remove_cptrref<Geometry>::type, util::remove_cptrref_t<Geometry>,
I, I,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
>::set(geometry, radius); >::set(geometry, radius);
} }
@ -162,12 +176,12 @@ namespace detail
template <typename Tag, typename Geometry, std::size_t Dimension> template <typename Tag, typename Geometry, std::size_t Dimension>
struct radius_access struct radius_access
{ {
static inline typename radius_type<Geometry>::type get(Geometry const& geometry) static inline radius_type_t<Geometry> get(Geometry const& geometry)
{ {
return traits::radius_access<Geometry, Dimension>::get(geometry); return traits::radius_access<Geometry, Dimension>::get(geometry);
} }
static inline void set(Geometry& geometry, static inline void set(Geometry& geometry,
typename radius_type<Geometry>::type const& value) radius_type_t<Geometry> const& value)
{ {
traits::radius_access<Geometry, Dimension>::set(geometry, value); traits::radius_access<Geometry, Dimension>::set(geometry, value);
} }
@ -181,33 +195,34 @@ struct radius_access
namespace core_dispatch namespace core_dispatch
{ {
template <typename Tag, template
typename Geometry, <
std::size_t Dimension> typename Tag,
struct radius_access<Tag, Geometry, Dimension, std::true_type> typename Geometry,
std::size_t Dimension
>
struct radius_access<Tag, Geometry, Dimension, true>
{ {
typedef typename geometry::radius_type<Geometry>::type radius_type; static inline radius_type_t<Geometry> get(const Geometry * geometry)
static inline radius_type get(const Geometry * geometry)
{ {
return radius_access return radius_access
< <
Tag, Tag,
Geometry, Geometry,
Dimension, Dimension,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
>::get(*geometry); >::get(*geometry);
} }
static inline void set(Geometry * geometry, radius_type const& value) static inline void set(Geometry * geometry, radius_type_t<Geometry> const& value)
{ {
return radius_access return radius_access
< <
Tag, Tag,
Geometry, Geometry,
Dimension, Dimension,
typename std::is_pointer<Geometry>::type std::is_pointer<Geometry>::value
>::set(*geometry, value); >::set(*geometry, value);
} }
}; };
@ -215,11 +230,11 @@ struct radius_access<Tag, Geometry, Dimension, std::true_type>
template <typename Geometry> template <typename Geometry>
struct radius_type<srs_sphere_tag, Geometry> struct radius_type<srs_sphere_tag, Geometry>
{ {
typedef typename traits::radius_type<Geometry>::type type; using type = typename traits::radius_type<Geometry>::type;
}; };
template <typename Geometry, std::size_t Dimension> template <typename Geometry, std::size_t Dimension>
struct radius_access<srs_sphere_tag, Geometry, Dimension, std::false_type> struct radius_access<srs_sphere_tag, Geometry, Dimension, false>
: detail::radius_access<srs_sphere_tag, Geometry, Dimension> : detail::radius_access<srs_sphere_tag, Geometry, Dimension>
{ {
//BOOST_STATIC_ASSERT(Dimension == 0); //BOOST_STATIC_ASSERT(Dimension == 0);
@ -229,11 +244,11 @@ struct radius_access<srs_sphere_tag, Geometry, Dimension, std::false_type>
template <typename Geometry> template <typename Geometry>
struct radius_type<srs_spheroid_tag, Geometry> struct radius_type<srs_spheroid_tag, Geometry>
{ {
typedef typename traits::radius_type<Geometry>::type type; using type = typename traits::radius_type<Geometry>::type;
}; };
template <typename Geometry, std::size_t Dimension> template <typename Geometry, std::size_t Dimension>
struct radius_access<srs_spheroid_tag, Geometry, Dimension, std::false_type> struct radius_access<srs_spheroid_tag, Geometry, Dimension, false>
: detail::radius_access<srs_spheroid_tag, Geometry, Dimension> : detail::radius_access<srs_spheroid_tag, Geometry, Dimension>
{ {
//BOOST_STATIC_ASSERT(Dimension == 0 || Dimension == 2); //BOOST_STATIC_ASSERT(Dimension == 0 || Dimension == 2);

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
@ -57,8 +58,8 @@ struct reverse_dispatch<GeometryId, GeometryId> : std::false_type {};
template <typename Geometry1, typename Geometry2> template <typename Geometry1, typename Geometry2>
struct reverse_dispatch : detail::reverse_dispatch struct reverse_dispatch : detail::reverse_dispatch
< <
geometry_id<Geometry1>::type::value, geometry_id<Geometry1>::value,
geometry_id<Geometry2>::type::value geometry_id<Geometry2>::value
> >
{}; {};

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015-2021. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
@ -201,24 +202,30 @@ struct ring_type<multi_polygon_tag, MultiPolygon>
template <typename Geometry> template <typename Geometry>
struct ring_type struct ring_type
{ {
typedef typename core_dispatch::ring_type using type = typename core_dispatch::ring_type
< <
typename tag<Geometry>::type, typename tag<Geometry>::type,
Geometry Geometry
>::type type; >::type;
}; };
template <typename Geometry>
using ring_type_t = typename ring_type<Geometry>::type;
template <typename Geometry> template <typename Geometry>
struct ring_return_type struct ring_return_type
{ {
typedef typename core_dispatch::ring_return_type using type = typename core_dispatch::ring_return_type
< <
typename tag<Geometry>::type, typename tag<Geometry>::type,
Geometry Geometry
>::type type; >::type;
}; };
template <typename Geometry>
using ring_return_type_t = typename ring_return_type<Geometry>::type;
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates. // Modifications copyright (c) 2020 Oracle and/or its affiliates.
@ -62,12 +63,17 @@ struct tag
template <typename Geometry> template <typename Geometry>
struct tag struct tag
{ {
typedef typename traits::tag using type = typename traits::tag
< <
typename util::remove_cptrref<Geometry>::type util::remove_cptrref_t<Geometry>
>::type type; >::type;
}; };
template <typename Geometry>
using tag_t = typename tag<Geometry>::type;
}} // namespace boost::geometry }} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_HPP #endif // BOOST_GEOMETRY_CORE_TAG_HPP

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
@ -41,15 +42,14 @@ namespace boost { namespace geometry
template <typename Tag, typename ...BaseTags> template <typename Tag, typename ...BaseTags>
struct tag_cast struct tag_cast
{ {
typedef Tag type; using type = Tag;
}; };
#ifndef DOXYGEN_NO_SPECIALIZATIONS #ifndef DOXYGEN_NO_SPECIALIZATIONS
template <typename Tag, typename BaseTag, typename ...BaseTags> template <typename Tag, typename BaseTag, typename ...BaseTags>
struct tag_cast<Tag, BaseTag, BaseTags...> struct tag_cast<Tag, BaseTag, BaseTags...>
{ : std::conditional
typedef std::conditional_t
< <
std::is_base_of<BaseTag, Tag>::value, std::is_base_of<BaseTag, Tag>::value,
BaseTag, BaseTag,
@ -57,12 +57,16 @@ struct tag_cast<Tag, BaseTag, BaseTags...>
< <
Tag, BaseTags... Tag, BaseTags...
>::type >::type
> type; >
}; {};
#endif // DOXYGEN_NO_SPECIALIZATIONS #endif // DOXYGEN_NO_SPECIALIZATIONS
template <typename Tag, typename ...BaseTags>
using tag_cast_t = typename tag_cast<Tag, BaseTags...>::type;
}} // namespace boost::geometry }} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP #endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP

View File

@ -152,6 +152,9 @@ struct single_tag_of<multi_polygon_tag>
#endif #endif
template <typename Tag>
using single_tag_of_t = typename single_tag_of<Tag>::type;
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020-2022. // This file was modified by Oracle on 2020-2022.
// Modifications copyright (c) 2020-2022, Oracle and/or its affiliates. // Modifications copyright (c) 2020-2022, Oracle and/or its affiliates.
@ -102,6 +103,12 @@ struct topological_dimension
: core_dispatch::top_dim<typename tag<Geometry>::type> {}; : core_dispatch::top_dim<typename tag<Geometry>::type> {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename Geometry>
inline constexpr int topological_dimension_v = topological_dimension<Geometry>::value;
#endif
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -1,7 +1,8 @@
// Boost.Geometry // 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 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
@ -26,86 +27,130 @@ namespace util
template <typename T> template <typename T>
struct is_geometry struct is_geometry
: bool_constant<! std::is_void<typename tag<T>::type>::value> : bool_constant<! std::is_void<tag_t<T>>::value>
{}; {};
template <typename T> template <typename T>
struct is_not_geometry struct is_not_geometry
: std::is_void<typename tag<T>::type> : std::is_void<tag_t<T>>
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename T>
inline constexpr bool is_geometry_v = is_geometry<T>::value;
template <typename T>
inline constexpr bool is_not_geometry_v = is_not_geometry<T>::value;
#endif
template <typename T> template <typename T>
struct is_point struct is_point
: std::is_same<point_tag, typename tag<T>::type> : std::is_same<point_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_multi_point struct is_multi_point
: std::is_same<multi_point_tag, typename tag<T>::type> : std::is_same<multi_point_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_pointlike struct is_pointlike
: std::is_base_of<pointlike_tag, typename tag<T>::type> : std::is_base_of<pointlike_tag, tag_t<T>>
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename T>
inline constexpr bool is_point_v = is_point<T>::value;
template <typename T>
inline constexpr bool is_multi_point_v = is_multi_point<T>::value;
template <typename T>
inline constexpr bool is_pointlike_v = is_pointlike<T>::value;
#endif
template <typename T> template <typename T>
struct is_segment struct is_segment
: std::is_same<segment_tag, typename tag<T>::type> : std::is_same<segment_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_linestring struct is_linestring
: std::is_same<linestring_tag, typename tag<T>::type> : std::is_same<linestring_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_multi_linestring struct is_multi_linestring
: std::is_same<multi_linestring_tag, typename tag<T>::type> : std::is_same<multi_linestring_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_polylinear struct is_polylinear
: std::is_base_of<polylinear_tag, typename tag<T>::type> : std::is_base_of<polylinear_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_linear struct is_linear
: std::is_base_of<linear_tag, typename tag<T>::type> : std::is_base_of<linear_tag, tag_t<T>>
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename T>
inline constexpr bool is_segment_v = is_segment<T>::value;
template <typename T>
inline constexpr bool is_linestring_v = is_linestring<T>::value;
template <typename T>
inline constexpr bool is_multi_linestring_v = is_multi_linestring<T>::value;
template <typename T>
inline constexpr bool is_polylinear_v = is_polylinear<T>::value;
template <typename T>
inline constexpr bool is_linear_v = is_linear<T>::value;
#endif
template <typename T> template <typename T>
struct is_box struct is_box
: std::is_same<box_tag, typename tag<T>::type> : std::is_same<box_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_ring struct is_ring
: std::is_same<ring_tag, typename tag<T>::type> : std::is_same<ring_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_polygon struct is_polygon
: std::is_same<polygon_tag, typename tag<T>::type> : std::is_same<polygon_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_multi_polygon struct is_multi_polygon
: std::is_same<multi_polygon_tag, typename tag<T>::type> : std::is_same<multi_polygon_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_polygonal struct is_polygonal
: std::is_base_of<polygonal_tag, typename tag<T>::type> : std::is_base_of<polygonal_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_areal struct is_areal
: std::is_base_of<areal_tag, typename tag<T>::type> : std::is_base_of<areal_tag, tag_t<T>>
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename T>
inline constexpr bool is_box_v = is_box<T>::value;
template <typename T>
inline constexpr bool is_ring_v = is_ring<T>::value;
template <typename T>
inline constexpr bool is_polygon_v = is_polygon<T>::value;
template <typename T>
inline constexpr bool is_multi_polygon_v = is_multi_polygon<T>::value;
template <typename T>
inline constexpr bool is_polygonal_v = is_polygonal<T>::value;
template <typename T>
inline constexpr bool is_areal_v = is_areal<T>::value;
#endif
template <typename T> template <typename T>
struct is_segmental struct is_segmental
@ -117,36 +162,48 @@ struct is_polysegmental
: bool_constant<is_polylinear<T>::value || is_polygonal<T>::value> : bool_constant<is_polylinear<T>::value || is_polygonal<T>::value>
{}; {};
template <typename T> template <typename T>
struct is_multi struct is_multi
: std::is_base_of<multi_tag, typename tag<T>::type> : std::is_base_of<multi_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_multi_element struct is_multi_element
: bool_constant<is_point<T>::value || is_linestring<T>::value || is_polygon<T>::value> : bool_constant<is_point<T>::value || is_linestring<T>::value || is_polygon<T>::value>
{}; {};
template <typename T> template <typename T>
struct is_single struct is_single
: std::is_base_of<single_tag, typename tag<T>::type> : std::is_base_of<single_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_geometry_collection struct is_geometry_collection
: std::is_same<geometry_collection_tag, typename tag<T>::type> : std::is_same<geometry_collection_tag, tag_t<T>>
{}; {};
template <typename T> template <typename T>
struct is_dynamic_geometry struct is_dynamic_geometry
: std::is_same<dynamic_geometry_tag, typename tag<T>::type> : std::is_same<dynamic_geometry_tag, tag_t<T>>
{}; {};
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
template <typename T>
inline constexpr bool is_segmental_v = is_segmental<T>::value;
template <typename T>
inline constexpr bool is_polysegmental_v = is_polysegmental<T>::value;
template <typename T>
inline constexpr bool is_multi_v = is_multi<T>::value;
template <typename T>
inline constexpr bool is_multi_element_v = is_multi_element<T>::value;
template <typename T>
inline constexpr bool is_single_v = is_single<T>::value;
template <typename T>
inline constexpr bool is_geometry_collection_v = is_geometry_collection<T>::value;
template <typename T>
inline constexpr bool is_dynamic_geometry_v = is_dynamic_geometry<T>::value;
#endif
template <typename Geometry, typename T = void> template <typename Geometry, typename T = void>
struct enable_if_point struct enable_if_point
@ -307,7 +364,8 @@ using enable_if_geometry_collection_t = typename enable_if_geometry_collection<G
\note Also a "ring" has areal properties within Boost.Geometry \note Also a "ring" has areal properties within Boost.Geometry
\ingroup core \ingroup core
*/ */
using util::is_areal; template <typename T>
using is_areal [[deprecated("Use util::is_areal<> instead.")]] = util::is_areal<T>;
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -1,7 +1,8 @@
// Boost.Geometry // 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 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
@ -54,6 +55,7 @@ struct conjunction<Trait, Traits...>
: std::conditional_t<Trait::value, conjunction<Traits...>, Trait> : std::conditional_t<Trait::value, conjunction<Traits...>, Trait>
{}; {};
// C++17 // C++17
template <typename ...> template <typename ...>
struct disjunction struct disjunction
@ -68,6 +70,7 @@ struct disjunction<Trait, Traits...>
: std::conditional_t<Trait::value, Trait, disjunction<Traits...>> : std::conditional_t<Trait::value, Trait, disjunction<Traits...>>
{}; {};
// C++17 // C++17
template <typename Trait> template <typename Trait>
struct negation struct negation
@ -195,22 +198,21 @@ using transcribe_cref_t = typename transcribe_cref<From, To>::type;
\endcode \endcode
*/ */
template <bool IsConst, typename Type> template <bool IsConst, typename Type>
struct add_const_if_c struct [[deprecated("Use util::transcribe_const<> instead.")]] add_const_if_c
{ : std::conditional
typedef std::conditional_t
< <
IsConst, IsConst,
Type const, Type const,
Type Type
> type; >
}; {};
namespace util namespace util
{ {
template <typename T> template <typename T>
using bare_type = remove_cptrref<T>; using bare_type [[deprecated("Use util::remove_cptrref<> instead.")]] = remove_cptrref<T>;
} // namespace util } // namespace util