From 72624bb0f10bf269ed9e88d0c296bf3b23bcb196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 26 Apr 2023 09:55:14 +0200 Subject: [PATCH] fix narrowing --- Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h | 2 +- STL_Extension/include/CGAL/array.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 9d9d1bfdb6f..00c23440cbe 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -69,7 +69,7 @@ public: template VectorC3(T1 &&x, T2 &&y, T3 &&z) - : base(Rep{std::forward(x), std::forward(y), std::forward(z)}) {} + : base(fwd_make_array(std::forward(x), std::forward(y), std::forward(z))) {} VectorC3(const FT_ &x, const FT_ &y, const FT_ &z, const FT_ &w) : base( w != FT_(1) ? CGAL::make_array(x/w, y/w, z/w) diff --git a/STL_Extension/include/CGAL/array.h b/STL_Extension/include/CGAL/array.h index ff234183f99..56fa985bdf7 100644 --- a/STL_Extension/include/CGAL/array.h +++ b/STL_Extension/include/CGAL/array.h @@ -54,6 +54,15 @@ make_array(const T & t, const Args & ... args) return a; } +template< typename T, typename... Args > +BOOST_CXX14_CONSTEXPR +std::array< T, sizeof...(Args) > +fwd_make_array(Args && ... args) +{ + std::array< T, sizeof...(Args) > a = { { static_cast(args)... } }; + return a; +} + // Functor version struct Construct_array