Merge pull request #1379 from barendgehrels/fix/issue_629

fix: avoid warnings for coordinate conversions and unused parameters
This commit is contained in:
Vissarion Fisikopoulos
2025-03-18 15:06:34 +02:00
committed by GitHub
4 changed files with 22 additions and 13 deletions

View File

@@ -21,6 +21,7 @@
#include <cstddef>
#include <vector>
#include <boost/core/ignore_unused.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
@@ -66,6 +67,8 @@ inline void display(MetaTurn const& meta_turn, const char* reason = "")
//<< " -> " << op_index
<< " " << reason
<< std::endl;
#else
boost::ignore_unused(meta_turn, reason);
#endif
}

View File

@@ -189,8 +189,7 @@ private:
public:
template <typename T>
static inline return_type apply(this_strategy const& strategy,
T const& distance)
static inline return_type apply(this_strategy const& , T const& distance)
{
return static_cast<return_type>(distance);
}

View File

@@ -33,6 +33,7 @@
#include <boost/geometry/strategies/compare.hpp>
#include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/util/promote_integral.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
@@ -205,23 +206,29 @@ public :
template <typename P1, typename P2, typename P>
static inline int apply(P1 const& p1, P2 const& p2, P const& p)
{
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
// Promote float->double, small int->int
using promoted_t = typename select_most_precise<coor_t, double>::type;
bool const are_all_integral_coordinates =
constexpr bool are_all_integral_coordinates =
std::is_integral<coordinate_type_t<P1>>::value
&& std::is_integral<coordinate_type_t<P2>>::value
&& std::is_integral<coordinate_type_t<P>>::value;
// Promote float to double
// For integer: short -> int -> long
// For larger integers: long, long long, std::int64_t all stay as they are (on a Mac)
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
using promoted_t = std::conditional_t
<
are_all_integral_coordinates,
typename promote_integral<coor_t>::type,
typename select_most_precise<coor_t, double>::type
>;
eps_policy< math::detail::equals_factor_policy<promoted_t> > epsp;
promoted_t s = compute_side_value
promoted_t const s = compute_side_value
<
coor_t, promoted_t, are_all_integral_coordinates
>::apply(p1, p2, p, epsp);
promoted_t const zero = promoted_t();
static promoted_t const zero = promoted_t();
return math::detail::equals_by_policy(s, zero, epsp.policy) ? 0
: s > zero ? 1
: -1;

View File

@@ -11,11 +11,11 @@
#ifndef BOOST_GEOMETRY_UTIL_PROMOTE_INTEGRAL_HPP
#define BOOST_GEOMETRY_UTIL_PROMOTE_INTEGRAL_HPP
// For now deactivate the use of multiprecision integers
// TODO: activate it later
// Uncommenting this macro will use Boost.Multiprecision's cpp_int<> as a last resort
// TODO (#1380): change this to BOOST_GEOMETRY_PROMOTE_INTEGER_TO_BOOST_MULTI_PRECISION
// to be able to let users actively choose to use Boost.Multiprecision, but not enable it by default
#define BOOST_GEOMETRY_NO_MULTIPRECISION_INTEGER
#include <climits>
#include <cstddef>
#include <type_traits>