diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 5d4b6eadc85..257f78c88ea 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -47,6 +47,10 @@ CGAL_BEGIN_NAMESPACE // not, or we let all this up to the compiler optimizer to figure out ? // - Some caching should be done at the Point_2 level. +#ifdef __VARIADIC_TEMPLATES +# define CGAL_HAS_VARIADIC_TEMPLATES +#endif + template class Filtered_predicate @@ -85,6 +89,30 @@ public: : ep(c2e(o1), c2e(o2)), ap(c2a(o1), c2a(o2)) {} +#ifdef CGAL_HAS_VARIADIC_TEMPLATES + template + result_type + operator()(const Args&... args) const +#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG + ; +#else + { + try + { + CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION)); + Protect_FPU_rounding P; + Ares res = ap(c2a(args)...); + if (! is_indeterminate(res)) + return res; + } + catch (Interval_nt_advanced::unsafe_comparison) {} + CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION)); + Protect_FPU_rounding P(CGAL_FE_TONEAREST); + return ep(c2e(args)...); + } +#endif +#else + template result_type operator()(const A1 &a1) const @@ -323,10 +351,34 @@ public: c2e(a5), c2e(a6), c2e(a7), c2e(a8), c2e(a9), c2e(a10) ); } #endif - // Idem for more than 10 arguments. Do it on demand. + +#endif }; +#ifdef CGAL_HAS_VARIADIC_TEMPLATES + +template + template +typename Filtered_predicate::result_type +Filtered_predicate:: + operator()(const Args&... args) const +{ + try + { + CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION)); + Protect_FPU_rounding P; + Ares res = ap(c2a(args)...); + if (! is_indeterminate(res)) + return res; + } + catch (Interval_nt_advanced::unsafe_comparison) {} + CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION)); + Protect_FPU_rounding P(CGAL_FE_TONEAREST); + return ep(c2e(args)...); +} +#else + #ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG template template @@ -549,6 +601,8 @@ Filtered_predicate:: #endif +#endif + CGAL_END_NAMESPACE #endif // CGAL_FILTERED_PREDICATE_H