From 993b36515c767476a96ec7bbdbfc9d2178f28888 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Sat, 23 Mar 2024 11:16:54 +0100 Subject: [PATCH] [fix] replace decltype by typename for some compilers --- .../detail/sections/sectionalize.hpp | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 3317ff70a..d9cd95885 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -721,24 +721,31 @@ struct sectionalize_multi template 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::type; + using box_t = typename section_t::box_type; + using coor_t = typename geometry::coordinate_type::type; + + static auto const eps = math::scaled_epsilon(1000); + for (auto& section : sections) { - using gt = decltype(section.bounding_box); - using ct = typename geometry::coordinate_type::type; - static ct const eps = math::scaled_epsilon(1000); expand_by_epsilon(section.bounding_box, eps); } }