Merge pull request #1255 from awulkiew/feature/type_aliases

Add alias templates for core and util traits
This commit is contained in:
Adam Wulkiewicz 2024-05-11 13:47:03 +02:00 committed by GitHub
commit a7644cb94d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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) 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<Geometry>::type copy;
geometry::point_type_t<Geometry> copy;
geometry::detail::conversion::convert_point_to_point(point, 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,
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)
{
@ -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<Polygon>::type;
using exterior_ring_type = typename ring_return_type<Polygon>::type;
using interior_ring_range_type = typename interior_return_type<Polygon>::type;
using ring_type = ring_type_t<Polygon>;
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);
}
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);
}
}
@ -159,8 +158,8 @@ template
<
typename Geometry,
typename RangeOrPoint,
typename Tag = typename geometry::tag<Geometry>::type,
typename OtherTag = typename geometry::tag<RangeOrPoint>::type
typename Tag = geometry::tag_t<Geometry>,
typename OtherTag = geometry::tag_t<RangeOrPoint>
>
struct append
: detail::append::append_no_action

View File

@ -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<Geometry>::type
typename Tag = tag_t<Geometry>
>
struct area : detail::calculate_null
{
template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::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 <typename Polygon>
struct area<Polygon, polygon_tag> : detail::calculate_polygon_sum
{
template <typename Strategy>
static inline typename area_result<Polygon, Strategy>::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 <typename MultiGeometry>
struct area<MultiGeometry, multi_polygon_tag> : detail::multi_sum
{
template <typename Strategy>
static inline typename area_result<MultiGeometry, Strategy>::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 <typename Geometry>
static inline typename area_result<Geometry, Strategy>::type
apply(Geometry const& geometry, Strategy const& strategy)
static inline auto apply(Geometry const& geometry, Strategy const& strategy)
{
return dispatch::area<Geometry>::apply(geometry, strategy);
}
@ -230,8 +226,7 @@ template <>
struct area<default_strategy, false>
{
template <typename Geometry>
static inline typename area_result<Geometry>::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<default_strategy, false>
namespace resolve_dynamic
{
template <typename Geometry, typename Tag = typename geometry::tag<Geometry>::type>
template <typename Geometry, typename Tag = geometry::tag_t<Geometry>>
struct area
{
template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type
apply(Geometry const& geometry, Strategy const& strategy)
static inline auto apply(Geometry const& geometry, Strategy const& strategy)
{
return resolve_strategy::area<Strategy>::apply(geometry, strategy);
}
@ -264,8 +258,7 @@ template <typename Geometry>
struct area<Geometry, dynamic_geometry_tag>
{
template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type
apply(Geometry const& geometry, Strategy const& strategy)
static inline auto apply(Geometry const& geometry, Strategy const& strategy)
{
typename area_result<Geometry, Strategy>::type result = 0;
traits::visit<Geometry>::apply([&](auto const& g)
@ -280,8 +273,7 @@ template <typename Geometry>
struct area<Geometry, geometry_collection_tag>
{
template <typename Strategy>
static inline typename area_result<Geometry, Strategy>::type
apply(Geometry const& geometry, Strategy const& strategy)
static inline auto apply(Geometry const& geometry, Strategy const& strategy)
{
typename area_result<Geometry, Strategy>::type result = 0;
detail::visit_breadth_first([&](auto const& g)
@ -318,8 +310,7 @@ and Geographic as well.
\qbk{[area] [area_output]}
*/
template <typename Geometry>
inline typename area_result<Geometry>::type
area(Geometry const& geometry)
inline auto area(Geometry const& geometry)
{
concepts::check<Geometry const>();
@ -354,8 +345,7 @@ area(Geometry const& geometry)
}
*/
template <typename Geometry, typename Strategy>
inline typename area_result<Geometry, Strategy>::type
area(Geometry const& geometry, Strategy const& strategy)
inline auto area(Geometry const& geometry, Strategy const& strategy)
{
concepts::check<Geometry const>();

View File

@ -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<Geometry>::type,
tag_t<Geometry>,
Geometry
>::apply(geometry);
}
@ -111,7 +112,7 @@ inline void assign_zero(Geometry& geometry)
dispatch::assign_zero
<
typename tag<Geometry>::type,
tag_t<Geometry>,
Geometry
>::apply(geometry);
}
@ -141,9 +142,9 @@ inline void assign_values(Geometry& geometry, Type const& c1, Type const& c2)
dispatch::assign
<
typename tag<Geometry>::type,
tag_t<Geometry>,
Geometry,
geometry::dimension<Geometry>::type::value
geometry::dimension<Geometry>::value
>::apply(geometry, c1, c2);
}
@ -174,9 +175,9 @@ inline void assign_values(Geometry& geometry,
dispatch::assign
<
typename tag<Geometry>::type,
tag_t<Geometry>,
Geometry,
geometry::dimension<Geometry>::type::value
geometry::dimension<Geometry>::value
>::apply(geometry, c1, c2, c3);
}
@ -201,9 +202,9 @@ inline void assign_values(Geometry& geometry,
dispatch::assign
<
typename tag<Geometry>::type,
tag_t<Geometry>,
Geometry,
geometry::dimension<Geometry>::type::value
geometry::dimension<Geometry>::value
>::apply(geometry, c1, c2, c3, c4);
}

View File

@ -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<Ring const>::type;
using point_type = geometry::point_type_t<Ring const>;
strategy.apply(static_cast<point_type const&>(previous_pt),
static_cast<point_type const&>(pt),
state);
@ -208,7 +208,7 @@ struct centroid_range
typename Strategy::template state_type
<
typename geometry::point_type<Range>::type,
geometry::point_type_t<Range>,
Point
>::type state;
@ -265,7 +265,7 @@ struct centroid_polygon
typename Strategy::template state_type
<
typename geometry::point_type<Polygon>::type,
geometry::point_type_t<Polygon>,
Point
>::type state;
@ -333,7 +333,7 @@ struct centroid_multi
typename Strategy::template state_type
<
typename geometry::point_type<Multi>::type,
geometry::point_type_t<Multi>,
Point
>::type state;
@ -393,7 +393,7 @@ namespace dispatch
template
<
typename Geometry,
typename Tag = typename tag<Geometry>::type
typename Tag = tag_t<Geometry>
>
struct centroid: not_implemented<Tag>
{};
@ -511,10 +511,10 @@ struct centroid<default_strategy, false>
template <typename Geometry, typename Point>
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<Geometry>::apply(geometry, out, strategies_type());
}
@ -525,7 +525,7 @@ struct centroid<default_strategy, false>
namespace resolve_dynamic {
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
template <typename Geometry, typename Tag = tag_t<Geometry>>
struct centroid
{
template <typename Point, typename Strategy>

View File

@ -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<Polygon>::type
>::type
>
>::apply(interior_rings(polygon));
traits::clear
<
typename std::remove_reference
std::remove_reference_t
<
typename traits::ring_mutable_type<Polygon>::type
>::type
>
>::apply(exterior_ring(polygon));
}
};
@ -90,7 +91,7 @@ namespace dispatch
template
<
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>
{};

View File

@ -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<Box>::type coordinate_type;
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, Box,
@ -171,8 +169,7 @@ struct range_to_range
// point for open output.
view_type const view(source);
typedef typename boost::range_size<Range1>::type size_type;
size_type n = boost::size(view);
auto n = boost::size(view);
if (geometry::closure<Range2>::value == geometry::open)
{
n--;
@ -181,7 +178,7 @@ struct range_to_range
// If size == 0 && geometry::open <=> n = numeric_limits<size_type>::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 <typename Polygon1, typename Polygon2>
struct polygon_to_polygon
{
typedef range_to_range
using per_ring = range_to_range
<
typename geometry::ring_type<Polygon1>::type,
typename geometry::ring_type<Polygon2>::type,
geometry::point_order<Polygon1>::value
!= geometry::point_order<Polygon2>::value
> per_ring;
geometry::ring_type_t<Polygon1>,
geometry::ring_type_t<Polygon2>,
geometry::point_order<Polygon1>::value != geometry::point_order<Polygon2>::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<Polygon2>::type
>::type
std::remove_reference_t
<
typename traits::interior_mutable_type<Polygon2>::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<typename tag<Geometry1>::type, multi_tag>::type,
typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
std::size_t DimensionCount = dimension<Geometry1>::type::value,
typename Tag1 = tag_cast_t<tag_t<Geometry1>, multi_tag>,
typename Tag2 = tag_cast_t<tag_t<Geometry2>, multi_tag>,
std::size_t DimensionCount = dimension<Geometry1>::value,
bool UseAssignment = std::is_same<Geometry1, Geometry2>::value
&& !std::is_array<Geometry1>::value
>
@ -353,8 +349,7 @@ struct convert<Ring1, Ring2, ring_tag, ring_tag, DimensionCount, false>
<
Ring1,
Ring2,
geometry::point_order<Ring1>::value
!= geometry::point_order<Ring2>::value
geometry::point_order<Ring1>::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<Multi2>::type,
typename single_tag_of
<
typename tag<Multi1>::type
>::type,
typename single_tag_of
<
typename tag<Multi2>::type
>::type,
single_tag_of_t<tag_t<Multi1>>,
single_tag_of_t<tag_t<Multi2>>,
DimensionCount
>
>
@ -485,11 +474,8 @@ struct convert<Single, Multi, SingleTag, multi_tag, DimensionCount, false>
<
Single,
typename boost::range_value<Multi>::type,
typename tag<Single>::type,
typename single_tag_of
<
typename tag<Multi>::type
>::type,
tag_t<Single>,
single_tag_of_t<tag_t<Multi>>,
DimensionCount,
false
>

View File

@ -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 <typename Box, typename Strategy>
static inline void apply(Box& box, Strategy const& )
{
using coordinate_type = typename geometry::coordinate_type<Box>::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<min_corner, dimension>(box) > get<max_corner, dimension>(box))
{
// Swap the coordinates
coordinate_type max_value = get<min_corner, dimension>(box);
coordinate_type min_value = get<max_corner, dimension>(box);
auto max_value = get<min_corner, dimension>(box);
auto min_value = get<max_corner, dimension>(box);
set<min_corner, dimension>(box, min_value);
set<max_corner, dimension>(box, max_value);
}
@ -144,7 +142,7 @@ struct correct_polygon
namespace dispatch
{
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct: not_implemented<Tag>
{};
@ -252,7 +250,7 @@ struct correct<default_strategy, false>
namespace resolve_dynamic
{
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct
{
template <typename Strategy>

View File

@ -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 <typename Geometry, typename Tag = typename tag<Geometry>::type>
template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct_closure: not_implemented<Tag>
{};
@ -166,7 +167,7 @@ struct correct_closure<Geometry, multi_polygon_tag>
namespace resolve_variant
{
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
template <typename Geometry, typename Tag = tag_t<Geometry>>
struct correct_closure
{
static inline void apply(Geometry& geometry)

View File

@ -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 <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
@ -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<Geometry> get(Geometry const& 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);
}
@ -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<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 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 <typename Point, typename CoordinateType, std::size_t Dimension>
struct access<point_tag, Point, CoordinateType, Dimension, std::false_type>
template <typename Point, std::size_t Dimension>
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);
}
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);
}
};
template <typename Point, typename CoordinateType, std::size_t Dimension>
struct access<point_tag, Point, CoordinateType, Dimension, std::true_type>
template <typename Point, std::size_t Dimension>
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
<
typename Box,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<box_tag, Box, CoordinateType, Index, Dimension, std::false_type>
: detail::indexed_access_non_pointer<Box, CoordinateType, Index, Dimension>
struct indexed_access<box_tag, Box, Index, Dimension, false>
: detail::indexed_access_non_pointer<Box, Index, Dimension>
{};
template
<
typename Box,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<box_tag, Box, CoordinateType, Index, Dimension, std::true_type>
: detail::indexed_access_pointer<Box, CoordinateType, Index, Dimension>
struct indexed_access<box_tag, Box, Index, Dimension, true>
: detail::indexed_access_pointer<Box, Index, Dimension>
{};
template
<
typename Segment,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<segment_tag, Segment, CoordinateType, Index, Dimension, std::false_type>
: detail::indexed_access_non_pointer<Segment, CoordinateType, Index, Dimension>
struct indexed_access<segment_tag, Segment, Index, Dimension, false>
: detail::indexed_access_non_pointer<Segment, Index, Dimension>
{};
template
<
typename Segment,
typename CoordinateType,
std::size_t Index,
std::size_t Dimension
>
struct indexed_access<segment_tag, Segment, CoordinateType, Index, Dimension, std::true_type>
: detail::indexed_access_pointer<Segment, CoordinateType, Index, Dimension>
struct indexed_access<segment_tag, Segment, Index, Dimension, true>
: detail::indexed_access_pointer<Segment, Index, Dimension>
{};
} // namespace core_dispatch
@ -265,22 +268,19 @@ struct signature_getset_index_dimension {};
\qbk{[include reference/core/get_point.qbk]}
*/
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
, detail::signature_getset_dimension* = 0
#endif
)
{
typedef core_dispatch::access
return core_dispatch::access
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type,
typename coordinate_type<Geometry>::type,
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>,
Dimension,
typename std::is_pointer<Geometry>::type
> coord_access_type;
return coord_access_type::get(geometry);
std::is_pointer<Geometry>::value
>::get(geometry);
}
@ -298,22 +298,19 @@ constexpr inline typename coordinate_type<Geometry>::type get(Geometry const& ge
*/
template <std::size_t Dimension, typename Geometry>
inline void set(Geometry& geometry
, typename coordinate_type<Geometry>::type const& value
, coordinate_type_t<Geometry> const& value
#ifndef DOXYGEN_SHOULD_SKIP_THIS
, detail::signature_getset_dimension* = 0
#endif
)
{
typedef core_dispatch::access
core_dispatch::access
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type,
typename coordinate_type<Geometry>::type,
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>,
Dimension,
typename std::is_pointer<Geometry>::type
> coord_access_type;
coord_access_type::set(geometry, value);
std::is_pointer<Geometry>::value
>::set(geometry, value);
}
@ -331,23 +328,20 @@ inline void set(Geometry& geometry
\qbk{[include reference/core/get_box.qbk]}
*/
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
, detail::signature_getset_index_dimension* = 0
#endif
)
{
typedef core_dispatch::indexed_access
return core_dispatch::indexed_access
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type,
typename coordinate_type<Geometry>::type,
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>,
Index,
Dimension,
typename std::is_pointer<Geometry>::type
> coord_access_type;
return coord_access_type::get(geometry);
std::is_pointer<Geometry>::value
>::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>
inline void set(Geometry& geometry
, typename coordinate_type<Geometry>::type const& value
, coordinate_type_t<Geometry> 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<Geometry>::type,
typename util::remove_cptrref<Geometry>::type,
typename coordinate_type<Geometry>::type,
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>,
Index,
Dimension,
typename std::is_pointer<Geometry>::type
> coord_access_type;
coord_access_type::set(geometry, value);
std::is_pointer<Geometry>::value
>::set(geometry, value);
}
}} // namespace boost::geometry

View File

@ -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<multi_polygon_tag, MultiPolygon>
*/
template <typename Geometry>
struct closure
{
static const closure_selector value = core_dispatch::closure
: std::integral_constant
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
>::value;
};
closure_selector,
core_dispatch::closure
<
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
namespace detail
{
template
<
typename Geometry,
closure_selector Closure = geometry::closure<Geometry>::value
>
using minimum_ring_size = core_detail::closure::minimum_ring_size<Closure>;
template <typename Geometry>
using minimum_ring_size = core_detail::closure::minimum_ring_size
<
geometry::closure<Geometry>::value
>;
} // namespace detail
#endif // DOXYGEN_NO_DETAIL

View File

@ -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 <typename Geometry>
struct dimension
: core_dispatch::dimension
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
tag_t<Geometry>,
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
\ingroup utility

View File

@ -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 <typename Geometry>
struct coordinate_system
{
typedef typename core_dispatch::coordinate_system
using type = typename core_dispatch::coordinate_system
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
>::type type;
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>
>::type;
};
template <typename Geometry>
using coordinate_system_t = typename coordinate_system<Geometry>::type;
}} // namespace boost::geometry

View File

@ -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 <typename GeometryTag, typename Geometry>
struct coordinate_type
{
typedef typename point_type<GeometryTag, Geometry>::type point_type;
// 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>
struct coordinate_type<point_tag, Point>
{
typedef typename traits::coordinate_type
using type = typename traits::coordinate_type
<
typename util::remove_cptrref<Point>::type
>::type type;
util::remove_cptrref_t<Point>
>::type;
};
@ -86,13 +89,18 @@ struct coordinate_type<point_tag, Point>
template <typename Geometry>
struct coordinate_type
{
typedef typename core_dispatch::coordinate_type
using type = typename core_dispatch::coordinate_type
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
>::type type;
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>
>::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
\ingroup utility
@ -100,11 +108,8 @@ struct coordinate_type
template <typename Geometry1, typename Geometry2>
constexpr inline void assert_coordinate_type_equal(Geometry1 const& , Geometry2 const& )
{
static_assert(std::is_same
<
typename coordinate_type<Geometry1>::type,
typename coordinate_type<Geometry2>::type
>::value, "Coordinate types in geometries should be the same");
static_assert(std::is_same<coordinate_type_t<Geometry1>, coordinate_type_t<Geometry2>>::value,
"Coordinate types in geometries should be the same");
}
}} // namespace boost::geometry

View File

@ -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<cs::undefined>
template <typename Geometry>
struct cs_tag
{
typedef typename traits::cs_tag
using type = typename traits::cs_tag
<
typename geometry::coordinate_system<Geometry>::type
>::type type;
geometry::coordinate_system_t<Geometry>
>::type;
};
template <typename Geometry>
using cs_tag_t = typename cs_tag<Geometry>::type;
namespace traits
{
@ -287,13 +291,17 @@ namespace detail
template <typename Geometry>
struct cs_angular_units
{
typedef typename traits::cs_angular_units
using type = typename traits::cs_angular_units
<
typename geometry::coordinate_system<Geometry>::type
>::type type;
geometry::coordinate_system_t<Geometry>
>::type;
};
template <typename Geometry>
using cs_angular_units_t = typename cs_angular_units<Geometry>::type;
template <typename Units, typename CsTag>
struct cs_tag_to_coordinate_system
{
@ -332,6 +340,11 @@ struct cs_tag_to_coordinate_system<Units, geographic_tag>
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
#endif // DOXYGEN_NO_DETAIL

View File

@ -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<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

View File

@ -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<multi_polygon_tag, MultiPolygon>
*/
template <typename Geometry>
struct point_order
{
static const order_selector value = core_dispatch::point_order
: std::integral_constant
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
>::value;
};
order_selector,
core_dispatch::point_order
<
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

View File

@ -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<geometry_collection_tag, GeometryCollection>
template <typename Geometry>
struct point_type
{
typedef typename core_dispatch::point_type
using type = typename core_dispatch::point_type
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
>::type type;
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>
>::type;
};
template <typename Geometry>
using point_type_t = typename point_type<Geometry>::type;
}} // namespace boost::geometry

View File

@ -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 <cstddef>
#include <boost/static_assert.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/type_traits_std.hpp>
@ -79,18 +79,27 @@ namespace core_dispatch
template <typename Tag, typename Geometry>
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 <typename Tag,
typename Geometry,
std::size_t Dimension,
typename IsPointer>
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 <typename Geometry>
struct radius_type
{
typedef typename core_dispatch::radius_type
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type
>::type type;
using type = typename core_dispatch::radius_type
<
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>
>::type;
};
template <typename Geometry>
using radius_type_t = typename radius_type<Geometry>::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 <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
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type,
I,
typename std::is_pointer<Geometry>::type
>::get(geometry);
<
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>,
I,
std::is_pointer<Geometry>::value
>::get(geometry);
}
/*!
@ -142,14 +156,14 @@ inline typename radius_type<Geometry>::type get_radius(Geometry const& geometry)
*/
template <std::size_t I, typename Geometry>
inline void set_radius(Geometry& geometry,
typename radius_type<Geometry>::type const& radius)
radius_type_t<Geometry> const& radius)
{
core_dispatch::radius_access
<
typename tag<Geometry>::type,
typename util::remove_cptrref<Geometry>::type,
tag_t<Geometry>,
util::remove_cptrref_t<Geometry>,
I,
typename std::is_pointer<Geometry>::type
std::is_pointer<Geometry>::value
>::set(geometry, radius);
}
@ -162,12 +176,12 @@ namespace detail
template <typename Tag, typename Geometry, std::size_t Dimension>
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);
}
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);
}
@ -181,33 +195,34 @@ struct radius_access
namespace core_dispatch
{
template <typename Tag,
typename Geometry,
std::size_t Dimension>
struct radius_access<Tag, Geometry, Dimension, std::true_type>
template
<
typename Tag,
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 get(const Geometry * geometry)
static inline radius_type_t<Geometry> get(const Geometry * geometry)
{
return radius_access
<
Tag,
Geometry,
Dimension,
typename std::is_pointer<Geometry>::type
>::get(*geometry);
<
Tag,
Geometry,
Dimension,
std::is_pointer<Geometry>::value
>::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
<
Tag,
Geometry,
Dimension,
typename std::is_pointer<Geometry>::type
>::set(*geometry, value);
<
Tag,
Geometry,
Dimension,
std::is_pointer<Geometry>::value
>::set(*geometry, value);
}
};
@ -215,11 +230,11 @@ struct radius_access<Tag, Geometry, Dimension, std::true_type>
template <typename 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>
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>
{
//BOOST_STATIC_ASSERT(Dimension == 0);
@ -229,11 +244,11 @@ struct radius_access<srs_sphere_tag, Geometry, Dimension, std::false_type>
template <typename 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>
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>
{
//BOOST_STATIC_ASSERT(Dimension == 0 || Dimension == 2);

View File

@ -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<GeometryId, GeometryId> : std::false_type {};
template <typename Geometry1, typename Geometry2>
struct reverse_dispatch : detail::reverse_dispatch
<
geometry_id<Geometry1>::type::value,
geometry_id<Geometry2>::type::value
geometry_id<Geometry1>::value,
geometry_id<Geometry2>::value
>
{};

View File

@ -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<multi_polygon_tag, MultiPolygon>
template <typename Geometry>
struct ring_type
{
typedef typename core_dispatch::ring_type
using type = typename core_dispatch::ring_type
<
typename tag<Geometry>::type,
Geometry
>::type type;
>::type;
};
template <typename Geometry>
using ring_type_t = typename ring_type<Geometry>::type;
template <typename Geometry>
struct ring_return_type
{
typedef typename core_dispatch::ring_return_type
using type = typename core_dispatch::ring_return_type
<
typename tag<Geometry>::type,
Geometry
>::type type;
>::type;
};
template <typename Geometry>
using ring_return_type_t = typename ring_return_type<Geometry>::type;
}} // namespace boost::geometry

View File

@ -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 <typename Geometry>
struct tag
{
typedef typename traits::tag
using type = typename traits::tag
<
typename util::remove_cptrref<Geometry>::type
>::type type;
util::remove_cptrref_t<Geometry>
>::type;
};
template <typename Geometry>
using tag_t = typename tag<Geometry>::type;
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_HPP

View File

@ -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 <typename Tag, typename ...BaseTags>
struct tag_cast
{
typedef Tag type;
using type = Tag;
};
#ifndef DOXYGEN_NO_SPECIALIZATIONS
template <typename Tag, typename BaseTag, typename ...BaseTags>
struct tag_cast<Tag, BaseTag, BaseTags...>
{
typedef std::conditional_t
: std::conditional
<
std::is_base_of<BaseTag, Tag>::value,
BaseTag,
@ -57,12 +57,16 @@ struct tag_cast<Tag, BaseTag, BaseTags...>
<
Tag, BaseTags...
>::type
> type;
};
>
{};
#endif // DOXYGEN_NO_SPECIALIZATIONS
template <typename Tag, typename ...BaseTags>
using tag_cast_t = typename tag_cast<Tag, BaseTags...>::type;
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_CORE_TAG_CAST_HPP

View File

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

View File

@ -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<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

View File

@ -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 <typename T>
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>
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>
struct is_point
: std::is_same<point_tag, typename tag<T>::type>
: std::is_same<point_tag, tag_t<T>>
{};
template <typename T>
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>
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>
struct is_segment
: std::is_same<segment_tag, typename tag<T>::type>
: std::is_same<segment_tag, tag_t<T>>
{};
template <typename T>
struct is_linestring
: std::is_same<linestring_tag, typename tag<T>::type>
: std::is_same<linestring_tag, tag_t<T>>
{};
template <typename T>
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>
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>
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>
struct is_box
: std::is_same<box_tag, typename tag<T>::type>
: std::is_same<box_tag, tag_t<T>>
{};
template <typename T>
struct is_ring
: std::is_same<ring_tag, typename tag<T>::type>
: std::is_same<ring_tag, tag_t<T>>
{};
template <typename T>
struct is_polygon
: std::is_same<polygon_tag, typename tag<T>::type>
: std::is_same<polygon_tag, tag_t<T>>
{};
template <typename T>
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>
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>
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>
struct is_segmental
@ -117,36 +162,48 @@ struct is_polysegmental
: bool_constant<is_polylinear<T>::value || is_polygonal<T>::value>
{};
template <typename T>
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>
struct is_multi_element
: bool_constant<is_point<T>::value || is_linestring<T>::value || is_polygon<T>::value>
{};
template <typename T>
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>
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>
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>
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
\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

View File

@ -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<Trait, Traits...>
: std::conditional_t<Trait::value, conjunction<Traits...>, Trait>
{};
// C++17
template <typename ...>
struct disjunction
@ -68,6 +70,7 @@ struct disjunction<Trait, Traits...>
: std::conditional_t<Trait::value, Trait, disjunction<Traits...>>
{};
// C++17
template <typename Trait>
struct negation
@ -195,22 +198,21 @@ using transcribe_cref_t = typename transcribe_cref<From, To>::type;
\endcode
*/
template <bool IsConst, typename Type>
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 <typename T>
using bare_type = remove_cptrref<T>;
using bare_type [[deprecated("Use util::remove_cptrref<> instead.")]] = remove_cptrref<T>;
} // namespace util