[fix] replace decltype by typename for some compilers

This commit is contained in:
Barend Gehrels 2024-03-23 11:16:54 +01:00
parent 425263e166
commit 993b36515c

View File

@ -721,24 +721,31 @@ struct sectionalize_multi
template <typename Sections, typename Strategy>
inline void enlarge_sections(Sections& sections, Strategy const&)
{
// Expand the box to avoid missing any intersection. The amount is
// should be larger than epsilon. About the value itself: the smaller
// it is, the higher the risk to miss intersections. The larger it is,
// the more comparisons are made, which is not harmful for the result
// (but it might be for the performance).
// So it should be on the high side.
// Use a compilable and workable epsilon for all types, for example:
// Expand the box to avoid missing any intersection.
// About the value itself: the smaller it is,
// the higher the risk to miss intersections.
// The larger it is, the more comparisons are made,
// which is not harmful for the result,
// but it might be for the performance.
// So it should be on the higher side.
//
// The current value:
// - for double :~ 2.22e-13
// - for float :~ 1e-4
// - for Boost.Multiprecision (50) :~ 5.35e-48
// - for Boost.Rational : 0/1
// WARNING: don't use decltype here.
// Earlier code used decltype(section.bonding_box) below,
// but that somehow is not accepted by the NVCC (CUDA 12.4) compiler.
using section_t = typename boost::range_value<Sections>::type;
using box_t = typename section_t::box_type;
using coor_t = typename geometry::coordinate_type<box_t>::type;
static auto const eps = math::scaled_epsilon<coor_t>(1000);
for (auto& section : sections)
{
using gt = decltype(section.bounding_box);
using ct = typename geometry::coordinate_type<gt>::type;
static ct const eps = math::scaled_epsilon<ct>(1000);
expand_by_epsilon(section.bounding_box, eps);
}
}