From fe3ff9c19f93c8db1bc006049a09abd9a1c41b92 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 31 Mar 2020 21:02:32 +0200 Subject: [PATCH] Deduce reference return type in approx() By default, lambdas deduce the return type as a value type, not a reference. --- Filtered_kernel/include/CGAL/Lazy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 1dc7f2f12a2..067fbe57463 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -116,9 +116,9 @@ templateinline std::enable_if_t::value, unsigned> dept // For an iterator, exact/approx applies to the objects it points to template ::value>> -auto exact(T const& t) {return make_transforming_iterator(t,[](auto const&u){return CGAL::exact(u);});} +auto exact(T const& t) {return make_transforming_iterator(t,[](auto const&u)->decltype(auto){return CGAL::exact(u);});} template ::value>> -auto approx(T const& t) {return make_transforming_iterator(t,[](auto const&u){return CGAL::approx(u);});} +auto approx(T const& t) {return make_transforming_iterator(t,[](auto const&u)->decltype(auto){return CGAL::approx(u);});} template ::value>> unsigned depth(T const&) {return 1;} // FIXME: depth(*t) would be better when t is valid, but not for end iterators, and the true answer would iterate on the range, but we can't do that with only one iterator... We need to replace iterators with ranges to solve that.