Skip to content

Commit

Permalink
Merge pull request #1246 from barendgehrels/fix/compiler-errors-conve…
Browse files Browse the repository at this point in the history
…rter-base-of

fix compilation of converter and is_base_of
  • Loading branch information
vissarion authored Feb 26, 2024
2 parents fe18b6c + a31a4e1 commit 68c0861
Show file tree
Hide file tree
Showing 44 changed files with 229 additions and 195 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)));
util::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
util::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
util::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, util::numeric_cast<coordinate_type>(get<Corner1, 0>(box)));
geometry::set<1>(point, util::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, util::numeric_cast<coordinate_type>(x1));
geometry::set<0, 1>(geometry, util::numeric_cast<coordinate_type>(y1));
geometry::set<1, 0>(geometry, util::numeric_cast<coordinate_type>(x2));
geometry::set<1, 1>(geometry, util::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, util::numeric_cast<coordinate_type>(c1));
set<1>(point, util::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, util::numeric_cast<coordinate_type>(c1));
set<1>(point, util::numeric_cast<coordinate_type>(c2));
set<2>(point, util::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>(
util::numeric_cast<coordinate_type>(
geometry::get<min_corner, Dimension>(source)));
geometry::set<max_corner, Dimension>(destination,
boost::numeric_cast<coordinate_type>(
util::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, util::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 util::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(util::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 = util::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 @@ -30,6 +30,7 @@

#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>

#include <type_traits>

Expand All @@ -42,10 +43,12 @@ namespace detail { namespace relate {
// NOTE: This iterates through single geometries for which turns were not generated.
// It doesn't mean that the geometry is disjoint, only that no turns were detected.

template <std::size_t OpId,
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = std::is_base_of<multi_tag, Tag>::value
template
<
std::size_t OpId,
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = util::is_multi<Geometry>::value
>
struct for_each_disjoint_geometry_if
: public not_implemented<Tag>
Expand Down
7 changes: 2 additions & 5 deletions include/boost/geometry/algorithms/detail/single_geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/util/type_traits.hpp>

namespace boost { namespace geometry {

Expand All @@ -29,11 +30,7 @@ namespace detail_dispatch {
template
<
typename Geometry,
bool IsMulti = std::is_base_of
<
multi_tag,
typename geometry::tag<Geometry>::type
>::value
bool IsMulti = util::is_multi<Geometry>::value
>
struct single_geometry
{
Expand Down
10 changes: 7 additions & 3 deletions include/boost/geometry/algorithms/detail/sub_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <boost/geometry/core/tags.hpp>

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

namespace boost { namespace geometry {

Expand All @@ -33,9 +34,12 @@ namespace boost { namespace geometry {
#ifndef DOXYGEN_NO_DISPATCH
namespace detail_dispatch {

template <typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = std::is_base_of<multi_tag, Tag>::value>
template
<
typename Geometry,
typename Tag = typename geometry::tag<Geometry>::type,
bool IsMulti = util::is_multi<Geometry>::value
>
struct sub_range : not_implemented<Tag>
{};

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


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

namespace boost { namespace geometry {

Expand Down Expand Up @@ -142,8 +144,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 = util::is_multi<Geometry1>::value,
bool IsMulti2 = util::is_multi<Geometry2>::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 util::numeric_cast<ReturnType>(v);
}

public :
Expand Down
Loading

0 comments on commit 68c0861

Please sign in to comment.