Fix [-Wconversion] warnings with gcc

This commit is contained in:
Laurent Rineau 2020-03-06 10:31:11 +01:00
parent 473eeb1bd8
commit e3a97e1e62
3 changed files with 14 additions and 14 deletions

View File

@ -58,7 +58,7 @@ template<class R_,class Zero_> struct Construct_LA_vector
} }
template<class...U> template<class...U>
typename std::enable_if<Constructible_from_each<RT,U...>::value && typename std::enable_if<Constructible_from_each<RT,U...>::value &&
std::is_same<Dimension_tag<sizeof...(U)>, Dimension>::value, std::is_same<Dimension_tag<int(sizeof...(U))>, Dimension>::value,
result_type>::type result_type>::type
operator()(U&&...u)const{ operator()(U&&...u)const{
return typename Constructor::Values()(std::forward<U>(u)...); return typename Constructor::Values()(std::forward<U>(u)...);
@ -66,7 +66,7 @@ template<class R_,class Zero_> struct Construct_LA_vector
//template<class...U,class=typename std::enable_if<Constructible_from_each<RT,U...>::value>::type,class=typename std::enable_if<(sizeof...(U)==static_dim+1)>::type,class=void> //template<class...U,class=typename std::enable_if<Constructible_from_each<RT,U...>::value>::type,class=typename std::enable_if<(sizeof...(U)==static_dim+1)>::type,class=void>
template<class...U> template<class...U>
typename std::enable_if<Constructible_from_each<RT,U...>::value && typename std::enable_if<Constructible_from_each<RT,U...>::value &&
std::is_same<Dimension_tag<sizeof...(U)-1>, Dimension>::value, std::is_same<Dimension_tag<int(sizeof...(U)-1)>, Dimension>::value,
result_type>::type result_type>::type
operator()(U&&...u)const{ operator()(U&&...u)const{
return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...); return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...);

View File

@ -56,10 +56,10 @@ namespace internal {
// Whenever a construction takes iterator pairs as input, whether they point to double of Lazy objects, copy the ranges inside the lazy result so they are available for update_exact(). We analyze the input to try and guess where iterator pairs are. I would prefer if each functor had a specific signature (no overload in this layer) so we wouldn't have to guess. // Whenever a construction takes iterator pairs as input, whether they point to double of Lazy objects, copy the ranges inside the lazy result so they are available for update_exact(). We analyze the input to try and guess where iterator pairs are. I would prefer if each functor had a specific signature (no overload in this layer) so we wouldn't have to guess.
namespace Lazy_internal { namespace Lazy_internal {
template<class...>struct typelist{}; template<class...>struct typelist{};
template<int>struct arg_i{}; template<std::size_t>struct arg_i{};
template<int>struct arg_i_begin{}; template<std::size_t>struct arg_i_begin{};
template<int>struct arg_i_end{}; template<std::size_t>struct arg_i_end{};
template<int>struct arg_i_ip1_range{}; template<std::size_t>struct arg_i_ip1_range{};
template<class,class,class,class=void>struct analyze_args; template<class,class,class,class=void>struct analyze_args;
template<class T,class U>struct analyze_args<T,U,typelist<>> { template<class T,class U>struct analyze_args<T,U,typelist<>> {
typedef T creator; typedef T creator;
@ -73,24 +73,24 @@ struct analyze_args<typelist<T...>,typelist<U...>,typelist<It,It,W...>,std::enab
analyze_args<typelist<T...,arg_i_ip1_range<sizeof...(U)>>,typelist<U...,arg_i_begin<sizeof...(T)>,arg_i_end<sizeof...(T)>>,typelist<W...>> {}; analyze_args<typelist<T...,arg_i_ip1_range<sizeof...(U)>>,typelist<U...,arg_i_begin<sizeof...(T)>,arg_i_end<sizeof...(T)>>,typelist<W...>> {};
template<class...T> using analyze_args_for_lazy = analyze_args<typelist<>,typelist<>,typelist<T...>>; template<class...T> using analyze_args_for_lazy = analyze_args<typelist<>,typelist<>,typelist<T...>>;
template<class,class>struct extract1; template<class,class>struct extract1;
template<int i,class T>struct extract1<arg_i<i>,T>:std::tuple_element<i,T>{}; template<std::size_t i,class T>struct extract1<arg_i<i>,T>:std::tuple_element<i,T>{};
template<int i,class T>struct extract1<arg_i_ip1_range<i>,T>{ template<std::size_t i,class T>struct extract1<arg_i_ip1_range<i>,T>{
typedef std::tuple_element_t<i,T> E; typedef std::tuple_element_t<i,T> E;
typedef std::remove_cv_t<std::remove_reference_t<E>> It; typedef std::remove_cv_t<std::remove_reference_t<E>> It;
typedef typename std::iterator_traits<It>::value_type element_type; typedef typename std::iterator_traits<It>::value_type element_type;
// TODO: find a way to use an array of the right size, at least for the most frequent constructions // TODO: find a way to use an array of the right size, at least for the most frequent constructions
typedef std::vector<element_type> type; typedef std::vector<element_type> type;
}; };
template<int i,class...T>decltype(auto) template<std::size_t i,class...T>decltype(auto)
do_extract(arg_i<i>,std::tuple<T...>const&t) do_extract(arg_i<i>,std::tuple<T...>const&t)
{return std::get<i>(t);} {return std::get<i>(t);}
template<int i,class...T>decltype(auto) template<std::size_t i,class...T>decltype(auto)
do_extract(arg_i_begin<i>,std::tuple<T...>const&t) do_extract(arg_i_begin<i>,std::tuple<T...>const&t)
{return std::begin(std::get<i>(t));} {return std::begin(std::get<i>(t));}
template<int i,class...T>decltype(auto) template<std::size_t i,class...T>decltype(auto)
do_extract(arg_i_end<i>,std::tuple<T...>const&t) do_extract(arg_i_end<i>,std::tuple<T...>const&t)
{return std::end(std::get<i>(t));} {return std::end(std::get<i>(t));}
template<int i,class...T>decltype(auto) template<std::size_t i,class...T>decltype(auto)
do_extract(arg_i_ip1_range<i>,std::tuple<T...>const&t) do_extract(arg_i_ip1_range<i>,std::tuple<T...>const&t)
{ {
typedef std::tuple<T...> L; typedef std::tuple<T...> L;

View File

@ -18,9 +18,9 @@
namespace CGAL { namespace CGAL {
namespace internal { namespace internal {
template<int,class...> struct Apply_to_last_then_rest_; template<std::size_t,class...> struct Apply_to_last_then_rest_;
template<int d,class F,class T,class... U> template<std::size_t d,class F,class T,class... U>
struct Apply_to_last_then_rest_<d,F,T,U...> { struct Apply_to_last_then_rest_<d,F,T,U...> {
typedef typename Apply_to_last_then_rest_<d-1,F,U...,T>::result_type result_type; typedef typename Apply_to_last_then_rest_<d-1,F,U...,T>::result_type result_type;
inline result_type operator()(F&&f,T&&t,U&&...u)const{ inline result_type operator()(F&&f,T&&t,U&&...u)const{