From 9e2f375d10f437147c5683f4d3ff3322903f1749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 19 Jun 2024 11:21:44 +0200 Subject: [PATCH] check if Kernel provides the nested type --- .../CGAL/Frechet_distance/internal/curve.h | 13 ++++++---- ..._nested_type_Has_filtered_predicates_tag.h | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 STL_Extension/include/CGAL/STL_Extension/internal/Has_nested_type_Has_filtered_predicates_tag.h diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h index e5f6a746c53..e3233d67c4f 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace CGAL { @@ -59,14 +60,16 @@ public: static auto get_type() { + if constexpr (::CGAL::internal::Has_nested_type_Has_filtered_predicates_tag::value) + { if constexpr (K::Has_filtered_predicates_tag::value) { return typename K::Exact_kernel{}; - } else { - if constexpr (std::is_floating_point_v) - return CGAL::Simple_cartesian{}; - else - return K{}; } + } + if constexpr (std::is_floating_point_v) + return CGAL::Simple_cartesian{}; + else + return K{}; } using Rational_kernel = decltype(get_type()); diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/Has_nested_type_Has_filtered_predicates_tag.h b/STL_Extension/include/CGAL/STL_Extension/internal/Has_nested_type_Has_filtered_predicates_tag.h new file mode 100644 index 00000000000..4edca5871d5 --- /dev/null +++ b/STL_Extension/include/CGAL/STL_Extension/internal/Has_nested_type_Has_filtered_predicates_tag.h @@ -0,0 +1,24 @@ +// Copyright (c) 2024 GeometryFactory Sarl (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Sébastien Loriot + +#ifndef CGAL_HAS_NESTED_TYPE_HAS_FILTERED_PREDICATES_TAG_H +#define CGAL_HAS_NESTED_TYPE_HAS_FILTERED_PREDICATES_TAG_H + +#include + +namespace CGAL { +namespace internal { + +BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Has_filtered_predicates_tag, Has_filtered_predicates_tag, false) + +} } // end namespace CGAL::internal + +#endif // CGAL_HAS_NESTED_TYPE_HAS_FILTERED_PREDICATES_TAG_H