From 3346aed52bfdaa3e384f3ca0ddf154af77657e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 17 Mar 2015 16:17:49 +0100 Subject: [PATCH] make Kernel_traits::type::FT usable as return type of free function in a free function that has such a return type, if there are several overloads the return type of each should be instanciable. This fix will make incorrect usages break later while enabling the use in free function. --- Kernel_23/include/CGAL/Kernel_traits.h | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Kernel_23/include/CGAL/Kernel_traits.h b/Kernel_23/include/CGAL/Kernel_traits.h index 2ab73d5a12a..0b44f743724 100644 --- a/Kernel_23/include/CGAL/Kernel_traits.h +++ b/Kernel_23/include/CGAL/Kernel_traits.h @@ -25,12 +25,40 @@ #ifndef CGAL_KERNEL_TRAITS_H #define CGAL_KERNEL_TRAITS_H +#include +#include + namespace CGAL { +namespace internal_kernel_traits{ + BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_R,R,false) + + /// In case no specialization of CGAL::Kernel_traits is provided and the type used + /// is not coming from a CGAL Kernel, we provide a dummy Kernel just to break later + /// and only when it is used. This was introduced to avoid issues with a free function + /// return a nested type of the kernel through Kernel_traits. Even if the function + /// was not the one to consider, its return type should be instanciable. + template + struct Dummy_kernel + { + struct FT{}; + }; + + template ::value > + struct Kernel_traits{ + typedef typename T::R type; + }; + + template + struct Kernel_traits{ + typedef Dummy_kernel type; + }; +} // end of namespace internal_kernel_traits + template struct Kernel_traits { - typedef typename T::R Kernel; + typedef typename internal_kernel_traits::Kernel_traits::type Kernel; typedef Kernel type; };