From a1fdcd6170b109c7588b01111d4ed806531ca8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 20 Jan 2012 13:08:32 +0000 Subject: [PATCH] explicitly check that the Interval template parameter is an interval. MSVC is not able to eliminate the function even when the functor used is Null_functor that has no result_type. --- Interval_support/include/CGAL/Interval_traits.h | 17 +++++++++++++++-- STL_Extension/include/CGAL/tags.h | 11 +++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Interval_support/include/CGAL/Interval_traits.h b/Interval_support/include/CGAL/Interval_traits.h index 654ed8b51a3..6d434bc477d 100644 --- a/Interval_support/include/CGAL/Interval_traits.h +++ b/Interval_support/include/CGAL/Interval_traits.h @@ -52,6 +52,8 @@ #define CGAL_INTERVAL_TRAITS_H #include +#include +#include namespace CGAL { @@ -192,16 +194,27 @@ proper_subset(Interval interval1, Interval interval2) { // Set operations, functions returing Interval +//the enable_if is need for MSVC as it is not able to eliminate +//the function if Interval_traits::Intersection has no result_type +//(like Null_functor) template inline typename Interval_traits::Intersection::result_type -intersection(Interval interval1, Interval interval2) { +intersection(Interval interval1, Interval interval2, typename boost::enable_if< + boost::is_same< + typename Interval_traits::Is_interval, + Tag_true > >::type* = NULL +) { typename Interval_traits::Intersection intersection; return intersection(interval1, interval2); } template inline typename Interval_traits::Hull::result_type -hull(Interval interval1, Interval interval2) { +hull(Interval interval1, Interval interval2, typename boost::enable_if< + boost::is_same< + typename Interval_traits::Is_interval, + Tag_true > >::type* = NULL) +{ typename Interval_traits::Hull hull; return hull(interval1, interval2); } diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index 423fd26ae4b..79ac1f43a88 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -50,10 +50,13 @@ inline bool check_tag( Tag_false) {return false;} struct Null_tag {}; struct Null_functor { - #if defined(BOOST_MSVC) //temporary fix for VC - typedef Null_tag result_type; - typedef Null_tag second_argument_type; - #endif +//SL: I commented the following because I fixed +//in Interval_traits.h the global functions intersection and hull +//to check that the type is really an interval +// #if defined(BOOST_MSVC) //temporary fix for VC +// typedef Null_tag result_type; +// typedef Null_tag second_argument_type; +// #endif };