From 51bc69cca35a5a814ea61a5134a5f81fcedf2012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 6 Mar 2017 12:10:24 +0100 Subject: [PATCH] version without partial specialization the norms says that partial specialization should be done in a namespace (not inside a class) --- .../include/CGAL/Regular_traits_adaptor_2.h | 29 ++++++++----------- .../include/CGAL/Regular_traits_adaptor.h | 29 ++++++++----------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Triangulation_2/include/CGAL/Regular_traits_adaptor_2.h b/Triangulation_2/include/CGAL/Regular_traits_adaptor_2.h index 6d7476b10a5..93c39899d26 100644 --- a/Triangulation_2/include/CGAL/Regular_traits_adaptor_2.h +++ b/Triangulation_2/include/CGAL/Regular_traits_adaptor_2.h @@ -57,24 +57,19 @@ class Regular_traits_adaptor_2 typedef typename RTraits::Circle_2 Circle_2; typedef typename RTraits::Weighted_point_2 Weighted_point_2; - template - struct Conv_wp_to_p { - typedef T type; - }; + template + struct Conv_wp_to_p + { + typedef typename boost::remove_reference::type T_no_ref; - template <> - struct Conv_wp_to_p { - typedef Point_2 type; - }; - - template <> - struct Conv_wp_to_p { - typedef const Point_2 type; - }; - - template <> - struct Conv_wp_to_p { - typedef const Point_2& type; + typedef typename boost::mpl::if_< + typename boost::is_const::type, + typename boost::mpl::if_::type, + const Point_2&, + const Point_2>::type, + typename boost::mpl::if_::type, + Point_2&, + Point_2>::type >::type type; }; template struct result {}; diff --git a/Triangulation_3/include/CGAL/Regular_traits_adaptor.h b/Triangulation_3/include/CGAL/Regular_traits_adaptor.h index cca96814aed..9ea06382499 100644 --- a/Triangulation_3/include/CGAL/Regular_traits_adaptor.h +++ b/Triangulation_3/include/CGAL/Regular_traits_adaptor.h @@ -57,24 +57,19 @@ class Regular_traits_adaptor typedef typename RTraits::Sphere_3 Sphere_3; typedef typename RTraits::Weighted_point_3 Weighted_point_3; - template - struct Conv_wp_to_p { - typedef T type; - }; + template + struct Conv_wp_to_p + { + typedef typename boost::remove_reference::type T_no_ref; - template <> - struct Conv_wp_to_p { - typedef Point_3 type; - }; - - template <> - struct Conv_wp_to_p { - typedef const Point_3 type; - }; - - template <> - struct Conv_wp_to_p { - typedef const Point_3& type; + typedef typename boost::mpl::if_< + typename boost::is_const::type, + typename boost::mpl::if_::type, + const Point_3&, + const Point_3>::type, + typename boost::mpl::if_::type, + Point_3&, + Point_3>::type >::type type; }; template struct result {};