Skip to content

Commit

Permalink
fix compilation of converter and is_base_of
Browse files Browse the repository at this point in the history
by introducting boost::geometry::detail::numeric_cast
  • Loading branch information
barendgehrels committed Feb 24, 2024
1 parent 16a7423 commit e0231af
Show file tree
Hide file tree
Showing 41 changed files with 212 additions and 183 deletions.
4 changes: 2 additions & 2 deletions include/boost/geometry/algorithms/convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <cstddef>
#include <type_traits>

#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>
Expand All @@ -45,6 +44,7 @@

#include <boost/geometry/geometries/concepts/check.hpp>

#include <boost/geometry/util/numeric_cast.hpp>
#include <boost/geometry/util/range.hpp>

#include <boost/geometry/views/detail/closed_clockwise_view.hpp>
Expand Down Expand Up @@ -80,7 +80,7 @@ struct point_to_box
typedef typename coordinate_type<Box>::type coordinate_type;

set<Index, Dimension>(box,
boost::numeric_cast<coordinate_type>(get<Dimension>(point)));
geometry::detail::numeric_cast<coordinate_type>(get<Dimension>(point)));
point_to_box
<
Point, Box,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@

#include <cstddef>

#include <boost/numeric/conversion/cast.hpp>

#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/algorithm.hpp>
#include <boost/geometry/util/numeric_cast.hpp>


namespace boost { namespace geometry
Expand Down Expand Up @@ -60,7 +59,7 @@ inline void assign_point_to_index(Point const& point, Geometry& geometry)
detail::for_each_dimension<Geometry>([&](auto dimension)
{
geometry::set<Index, dimension>(geometry,
boost::numeric_cast
geometry::detail::numeric_cast
<
typename coordinate_type<Geometry>::type
>(geometry::get<dimension>(point)));
Expand Down Expand Up @@ -92,7 +91,7 @@ inline void assign_point_from_index(Geometry const& geometry, Point& point)
detail::for_each_dimension<Geometry>([&](auto dimension)
{
geometry::set<dimension>(point,
boost::numeric_cast
geometry::detail::numeric_cast
<
typename coordinate_type<Point>::type
>(geometry::get<Index, dimension>(geometry)));
Expand Down
24 changes: 12 additions & 12 deletions include/boost/geometry/algorithms/detail/assign_values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp>

#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/clear.hpp>
Expand All @@ -40,6 +39,7 @@

#include <boost/geometry/util/algorithm.hpp>
#include <boost/geometry/util/is_inverse_spheroidal_coordinates.hpp>
#include <boost/geometry/util/numeric_cast.hpp>


namespace boost { namespace geometry
Expand Down Expand Up @@ -117,8 +117,8 @@ inline void assign_box_2d_corner(Box const& box, Point& point)
// Copy coordinates
typedef typename coordinate_type<Point>::type coordinate_type;

geometry::set<0>(point, boost::numeric_cast<coordinate_type>(get<Corner1, 0>(box)));
geometry::set<1>(point, boost::numeric_cast<coordinate_type>(get<Corner2, 1>(box)));
geometry::set<0>(point, geometry::detail::numeric_cast<coordinate_type>(get<Corner1, 0>(box)));
geometry::set<1>(point, geometry::detail::numeric_cast<coordinate_type>(get<Corner2, 1>(box)));
}


Expand All @@ -136,10 +136,10 @@ struct assign_2d_box_or_segment
static inline void apply(Geometry& geometry,
Type const& x1, Type const& y1, Type const& x2, Type const& y2)
{
geometry::set<0, 0>(geometry, boost::numeric_cast<coordinate_type>(x1));
geometry::set<0, 1>(geometry, boost::numeric_cast<coordinate_type>(y1));
geometry::set<1, 0>(geometry, boost::numeric_cast<coordinate_type>(x2));
geometry::set<1, 1>(geometry, boost::numeric_cast<coordinate_type>(y2));
geometry::set<0, 0>(geometry, geometry::detail::numeric_cast<coordinate_type>(x1));
geometry::set<0, 1>(geometry, geometry::detail::numeric_cast<coordinate_type>(y1));
geometry::set<1, 0>(geometry, geometry::detail::numeric_cast<coordinate_type>(x2));
geometry::set<1, 1>(geometry, geometry::detail::numeric_cast<coordinate_type>(y2));
}
};

Expand Down Expand Up @@ -167,8 +167,8 @@ struct assign<point_tag, Point, 2>
template <typename T>
static inline void apply(Point& point, T const& c1, T const& c2)
{
set<0>(point, boost::numeric_cast<coordinate_type>(c1));
set<1>(point, boost::numeric_cast<coordinate_type>(c2));
set<0>(point, geometry::detail::numeric_cast<coordinate_type>(c1));
set<1>(point, geometry::detail::numeric_cast<coordinate_type>(c2));
}
};

Expand All @@ -180,9 +180,9 @@ struct assign<point_tag, Point, 3>
template <typename T>
static inline void apply(Point& point, T const& c1, T const& c2, T const& c3)
{
set<0>(point, boost::numeric_cast<coordinate_type>(c1));
set<1>(point, boost::numeric_cast<coordinate_type>(c2));
set<2>(point, boost::numeric_cast<coordinate_type>(c3));
set<0>(point, geometry::detail::numeric_cast<coordinate_type>(c1));
set<1>(point, geometry::detail::numeric_cast<coordinate_type>(c2));
set<2>(point, geometry::detail::numeric_cast<coordinate_type>(c3));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <iterator>

#include <boost/core/ignore_unused.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/rbegin.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

#include <cstddef>

#include <boost/numeric/conversion/cast.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/util/numeric_cast.hpp>


namespace boost { namespace geometry
Expand All @@ -45,10 +45,10 @@ struct indexed_to_indexed
typedef typename coordinate_type<Destination>::type coordinate_type;

geometry::set<min_corner, Dimension>(destination,
boost::numeric_cast<coordinate_type>(
geometry::detail::numeric_cast<coordinate_type>(
geometry::get<min_corner, Dimension>(source)));
geometry::set<max_corner, Dimension>(destination,
boost::numeric_cast<coordinate_type>(
geometry::detail::numeric_cast<coordinate_type>(
geometry::get<max_corner, Dimension>(source)));

indexed_to_indexed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

#include <cstddef>

#include <boost/numeric/conversion/cast.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/util/numeric_cast.hpp>


namespace boost { namespace geometry
Expand All @@ -45,7 +45,7 @@ struct point_to_point
{
typedef typename coordinate_type<Destination>::type coordinate_type;

set<Dimension>(destination, boost::numeric_cast<coordinate_type>(get<Dimension>(source)));
set<Dimension>(destination, geometry::detail::numeric_cast<coordinate_type>(get<Dimension>(source)));
point_to_point<Source, Destination, Dimension + 1, DimensionCount>::apply(source, destination);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <vector>

#include <boost/core/ignore_unused.hpp>
#include <boost/numeric/conversion/cast.hpp>

#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
Expand All @@ -44,6 +43,7 @@
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/has_nan_coordinate.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/numeric_cast.hpp>

#include <boost/geometry/strategies/disjoint.hpp>
#include <boost/geometry/strategies/distance.hpp>
Expand Down Expand Up @@ -285,7 +285,7 @@ class segment_to_box_2D
template <typename T>
static inline Result apply(T const& t)
{
return boost::numeric_cast<Result>(t);
return geometry::detail::numeric_cast<Result>(t);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EQUALS_COLLECT_VECTORS_HPP


#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/detail/normalize.hpp>
Expand All @@ -35,6 +34,7 @@
#include <boost/geometry/geometries/concepts/check.hpp>

#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/numeric_cast.hpp>
#include <boost/geometry/util/range.hpp>

#include <boost/geometry/views/detail/closed_clockwise_view.hpp>
Expand Down Expand Up @@ -77,7 +77,7 @@ struct collected_vector_cartesian

bool normalize()
{
T magnitude = math::sqrt(boost::numeric_cast<T>(dx * dx + dy * dy));
T magnitude = math::sqrt(geometry::detail::numeric_cast<T>(dx * dx + dy * dy));

// NOTE: shouldn't here math::equals() be called?
if (magnitude > 0)
Expand Down
2 changes: 0 additions & 2 deletions include/boost/geometry/algorithms/detail/recalculate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

#include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include <boost/geometry/geometries/helper_geometry.hpp>

#include <boost/geometry/util/numeric_cast.hpp>

namespace boost { namespace geometry
{

Expand Down Expand Up @@ -836,7 +838,7 @@ struct areal_areal
segment_identifier const& seg_id = turn.operations[OpId].seg_id;

signed_size_type
count = boost::numeric_cast<signed_size_type>(
count = geometry::detail::numeric_cast<signed_size_type>(
geometry::num_interior_rings(
detail::single_geometry(analyser.geometry, seg_id)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_WITHIN_NO_TURNS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_WITHIN_NO_TURNS_HPP


#include <type_traits>

#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/within/point_in_geometry.hpp>

Expand Down Expand Up @@ -142,8 +145,8 @@ template <typename Geometry1,
typename Geometry2,
typename Tag1 = typename geometry::tag<Geometry1>::type,
typename Tag2 = typename geometry::tag<Geometry2>::type,
bool IsMulti1 = boost::is_base_of<geometry::multi_tag, Tag1>::value,
bool IsMulti2 = boost::is_base_of<geometry::multi_tag, Tag2>::value>
bool IsMulti1 = std::is_base_of<geometry::multi_tag, Tag1>::value,
bool IsMulti2 = std::is_base_of<geometry::multi_tag, Tag2>::value>
struct within_no_turns_multi
{
template <typename Strategy> static inline
Expand Down
4 changes: 2 additions & 2 deletions include/boost/geometry/arithmetic/determinant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#include <boost/geometry/core/access.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/util/numeric_cast.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>

#include <boost/numeric/conversion/cast.hpp>

namespace boost { namespace geometry
{
Expand All @@ -33,7 +33,7 @@ class calculate_determinant
template <typename T>
static inline ReturnType rt(T const& v)
{
return boost::numeric_cast<ReturnType>(v);
return geometry::detail::numeric_cast<ReturnType>(v);
}

public :
Expand Down
11 changes: 5 additions & 6 deletions include/boost/geometry/core/radian_access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@

#include <cstddef>

#include <boost/numeric/conversion/cast.hpp>

#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/coordinate_promotion.hpp>

#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/numeric_cast.hpp>



Expand All @@ -48,7 +47,7 @@ struct degree_radian_converter

static inline coordinate_type get(Geometry const& geometry)
{
return boost::numeric_cast
return geometry::detail::numeric_cast
<
coordinate_type
>(geometry::get<Dimension>(geometry)
Expand All @@ -57,7 +56,7 @@ struct degree_radian_converter

static inline void set(Geometry& geometry, coordinate_type const& radians)
{
geometry::set<Dimension>(geometry, boost::numeric_cast
geometry::set<Dimension>(geometry, geometry::detail::numeric_cast
<
coordinate_type
>(radians * math::r2d<coordinate_type>()));
Expand Down Expand Up @@ -113,7 +112,7 @@ struct degree_radian_converter_box_segment

static inline coordinate_type get(Geometry const& geometry)
{
return boost::numeric_cast
return geometry::detail::numeric_cast
<
coordinate_type
>(geometry::get<Index, Dimension>(geometry)
Expand All @@ -122,7 +121,7 @@ struct degree_radian_converter_box_segment

static inline void set(Geometry& geometry, coordinate_type const& radians)
{
geometry::set<Index, Dimension>(geometry, boost::numeric_cast
geometry::set<Index, Dimension>(geometry, geometry::detail::numeric_cast
<
coordinate_type
>(radians * math::r2d<coordinate_type>()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <string>

#include <boost/concept_check.hpp>
#include <boost/numeric/conversion/cast.hpp>

#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
#include <boost/geometry/core/access.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/policies/robustness/rescale_policy.hpp>
#include <boost/geometry/policies/robustness/robust_type.hpp>
#include <boost/geometry/util/numeric_cast.hpp>
#include <boost/geometry/util/type_traits.hpp>

// TEMP
Expand Down Expand Up @@ -70,7 +71,7 @@ inline void scale_box_to_integer_range(Box const& box,
<
typename geometry::coordinate_type<Point>::type
>::type num_type;
num_type const diff = boost::numeric_cast<num_type>(detail::get_max_size(box));
num_type const diff = geometry::detail::numeric_cast<num_type>(detail::get_max_size(box));
num_type const range = 10000000.0; // Define a large range to get precise integer coordinates
num_type const half = 0.5;
if (math::equals(diff, num_type())
Expand All @@ -81,16 +82,16 @@ inline void scale_box_to_integer_range(Box const& box,
}
else
{
factor = boost::numeric_cast<num_type>(
boost::numeric_cast<boost::long_long_type>(half + range / diff));
factor = geometry::detail::numeric_cast<num_type>(
geometry::detail::numeric_cast<boost::long_long_type>(half + range / diff));
BOOST_GEOMETRY_ASSERT(factor >= 1);
}

// Assign input/output minimal points
detail::assign_point_from_index<0>(box, min_point);
num_type const two = 2;
boost::long_long_type const min_coordinate
= boost::numeric_cast<boost::long_long_type>(-range / two);
= geometry::detail::numeric_cast<boost::long_long_type>(-range / two);
assign_values(min_robust_point, min_coordinate, min_coordinate);
}

Expand Down
Loading

0 comments on commit e0231af

Please sign in to comment.