diff --git a/AABB_tree/include/CGAL/AABB_traits_3.h b/AABB_tree/include/CGAL/AABB_traits_3.h index 30a3fa77cd3..9342e69aa13 100644 --- a/AABB_tree/include/CGAL/AABB_traits_3.h +++ b/AABB_tree/include/CGAL/AABB_traits_3.h @@ -302,12 +302,11 @@ public: typename AT::Bounding_box operator()(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond) const { - typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm); - for(++first; first != beyond; ++first) - { - bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm); - } - return bbox; + return std::accumulate(first, beyond, + typename AT::Bounding_box{} /* empty bbox */, + [this](const typename AT::Bounding_box& bbox, const Primitive& pr) { + return bbox + m_traits.compute_bbox(pr, m_traits.bbm); + }); } }; diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 9dd8460abd2..fdc6a71817c 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -199,9 +199,7 @@ namespace CGAL { } /// returns the axis-aligned bounding box of the whole tree. - /// \pre `!empty()` const Bounding_box bbox() const { - CGAL_precondition(!empty()); if(size() > 1) return root_node()->bbox(); else